diff --git a/backend/controller/controller.go b/backend/controller/controller.go index 9e12e0f110..1a1386568e 100644 --- a/backend/controller/controller.go +++ b/backend/controller/controller.go @@ -205,6 +205,10 @@ func New(ctx context.Context, db *dal.DAL, config Config, runnerScaling scaling. svc.tasks.Parallel(maybeDevelBackoff(time.Second, time.Second*5), svc.syncRoutes) svc.tasks.Parallel(maybeDevelBackoff(time.Second*3, time.Second*5, makeBackoff(time.Second*2, time.Second*2)), svc.heartbeatController) svc.tasks.Parallel(maybeDevelBackoff(time.Second*5, time.Second*5), svc.updateControllersList) + // This should be a singleton task, but because this is the task that + // actually expires the leases used to run singleton tasks, it must be + // parallel. + svc.tasks.Parallel(maybeDevelBackoff(time.Second, time.Second*5), svc.expireStaleLeases) // Singleton tasks use leases to only run on a single controller. svc.tasks.Singleton(maybeDevelBackoff(time.Second*20, time.Second*20), svc.reapStaleControllers) @@ -212,7 +216,6 @@ func New(ctx context.Context, db *dal.DAL, config Config, runnerScaling scaling. svc.tasks.Singleton(maybeDevelBackoff(time.Second, time.Second*20), svc.releaseExpiredReservations) svc.tasks.Singleton(maybeDevelBackoff(time.Second, time.Second*5), svc.reconcileDeployments) svc.tasks.Singleton(maybeDevelBackoff(time.Second, time.Second*5), svc.reconcileRunners) - svc.tasks.Singleton(maybeDevelBackoff(time.Second, time.Second*5), svc.expireStaleLeases) return svc, nil } diff --git a/backend/controller/dal/lease_test.go b/backend/controller/dal/lease_test.go index ca4e76a87a..a72c9f805a 100644 --- a/backend/controller/dal/lease_test.go +++ b/backend/controller/dal/lease_test.go @@ -29,6 +29,9 @@ func leaseExists(t *testing.T, conn sql.DBI, idempotencyKey uuid.UUID, key lease } func TestLease(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } ctx := log.ContextWithNewDefaultLogger(context.Background()) conn := sqltest.OpenForTesting(ctx, t) dal, err := New(ctx, conn) @@ -57,6 +60,9 @@ func TestLease(t *testing.T) { } func TestExpireLeases(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } ctx := log.ContextWithNewDefaultLogger(context.Background()) conn := sqltest.OpenForTesting(ctx, t) dal, err := New(ctx, conn)