From 3af4a9a6eae1eb50f7e3afad62c1d189a0aac4dc Mon Sep 17 00:00:00 2001 From: Matt Toohey Date: Thu, 7 Mar 2024 15:57:27 +1100 Subject: [PATCH] Use same runner id generation as production --- .../scaling/localscaling/local_scaling.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/backend/controller/scaling/localscaling/local_scaling.go b/backend/controller/scaling/localscaling/local_scaling.go index 7e5d1ba209..e3d9e33585 100644 --- a/backend/controller/scaling/localscaling/local_scaling.go +++ b/backend/controller/scaling/localscaling/local_scaling.go @@ -2,7 +2,6 @@ package localscaling import ( "context" - "encoding/binary" "errors" "fmt" "net/url" @@ -28,8 +27,6 @@ type LocalScaling struct { portAllocator *bind.BindAllocator controllerAddresses []*url.URL - - idSeed int } func NewLocalScaling(portAllocator *bind.BindAllocator, controllerAddresses []*url.URL) (*LocalScaling, error) { @@ -82,6 +79,7 @@ func (l *LocalScaling) SetReplicas(ctx context.Context, replicas int, idleRunner Bind: l.portAllocator.Next(), ControllerEndpoint: controllerEndpoint, TemplateDir: templateDir(ctx), + Key: model.NewRunnerKey(), } name := fmt.Sprintf("runner%d", i) @@ -92,18 +90,6 @@ func (l *LocalScaling) SetReplicas(ctx context.Context, replicas int, idleRunner return err } - // Create a readable ULID for the runner. - idSeed := l.idSeed + 1 - l.idSeed = idSeed - - var ulid [16]byte - binary.BigEndian.PutUint32(ulid[10:], uint32(idSeed)) - ulidStr := fmt.Sprintf("%025X", ulid) - err := config.Key.Scan(ulidStr) - if err != nil { - return err - } - runnerCtx := log.ContextWithLogger(ctx, logger.Scope(name)) runnerCtx, cancel := context.WithCancel(runnerCtx)