@@ -143,6 +143,15 @@ func (p *Pool) Run() {
143143 return
144144 }
145145
146+ // Check if we should stop before scaling (non-blocking check)
147+ select {
148+ case <- p .ctx .Done ():
149+ return
150+ case <- p .stopCh :
151+ return
152+ default :
153+ }
154+
146155 curSize := p .GetCurrentSize ()
147156 desiredReplicas := p .GetReplicas ()
148157 pendingCreates := int (p .pendingCreates .Load ())
@@ -633,10 +642,6 @@ func (p *Pool) createSnapshot(ctx context.Context, image containerd.Image, snaps
633642 }
634643
635644 if ! snapshotExists {
636- if err := p .unpackImage (ctx , image ); err != nil {
637- return nil , fmt .Errorf ("unpack: %w" , err )
638- }
639-
640645 imageContent , err := image .RootFS (ctx )
641646 if err != nil {
642647 return nil , fmt .Errorf ("image: rootfs: %w" , err )
@@ -656,20 +661,6 @@ func (p *Pool) createSnapshot(ctx context.Context, image containerd.Image, snaps
656661 return mounts , nil
657662}
658663
659- // unpackImage unpacks a containerd image if it is not already unpacked.
660- func (p * Pool ) unpackImage (ctx context.Context , image containerd.Image ) error {
661- isUnpacked , err := image .IsUnpacked (ctx , defaultSnapshotter )
662- if err != nil {
663- return err
664- }
665-
666- if isUnpacked {
667- return nil
668- }
669-
670- return image .Unpack (ctx , defaultSnapshotter )
671- }
672-
673664// deleteGitHubRunner removes a runner from GitHub Actions
674665func (p * Pool ) deleteGitHubRunner (runnerName string , runnerID int64 ) {
675666 if runnerID == 0 {
0 commit comments