From 48c2ac5df41de755bb0115bde98fdad7fba5c85b Mon Sep 17 00:00:00 2001 From: luke-lombardi <33990301+luke-lombardi@users.noreply.github.com> Date: Wed, 22 May 2024 12:01:39 -0400 Subject: [PATCH] Always lock when getting workers (#245) --- pkg/repository/worker_redis.go | 4 ++-- pkg/scheduler/pool_sizing.go | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/repository/worker_redis.go b/pkg/repository/worker_redis.go index a17569f6a..adb0706d9 100644 --- a/pkg/repository/worker_redis.go +++ b/pkg/repository/worker_redis.go @@ -225,7 +225,7 @@ func (r *WorkerRedisRepository) GetAllWorkers() ([]*types.Worker, error) { } func (r *WorkerRedisRepository) GetAllWorkersInPool(poolName string) ([]*types.Worker, error) { - workers, err := r.getWorkers(false) + workers, err := r.getWorkers(true) if err != nil { return nil, err } @@ -241,7 +241,7 @@ func (r *WorkerRedisRepository) GetAllWorkersInPool(poolName string) ([]*types.W } func (r *WorkerRedisRepository) GetAllWorkersOnMachine(machineId string) ([]*types.Worker, error) { - workers, err := r.getWorkers(false) + workers, err := r.getWorkers(true) if err != nil { return nil, err } diff --git a/pkg/scheduler/pool_sizing.go b/pkg/scheduler/pool_sizing.go index 67cf2f66a..d87938592 100644 --- a/pkg/scheduler/pool_sizing.go +++ b/pkg/scheduler/pool_sizing.go @@ -1,17 +1,15 @@ package scheduler import ( - "context" "log" "time" "github.com/beam-cloud/beta9/pkg/types" ) -const poolMonitoringInterval = 1 * time.Second +const poolMonitoringInterval = 5 * time.Second type WorkerPoolSizer struct { - ctx context.Context controller WorkerPoolController config *types.WorkerPoolSizingConfig }