From e4be9509cd1e8a64124fcbe5faaf8b1fad61360e Mon Sep 17 00:00:00 2001 From: jsun-m <91754185+jsun-m@users.noreply.github.com> Date: Sat, 11 Jan 2025 11:07:06 -0700 Subject: [PATCH] Fix: Hotfix build container ttl key trimming (#849) --- pkg/abstractions/image/image.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/abstractions/image/image.go b/pkg/abstractions/image/image.go index 95d43e8ef..9f3928c3e 100644 --- a/pkg/abstractions/image/image.go +++ b/pkg/abstractions/image/image.go @@ -223,11 +223,13 @@ func (is *RuncImageService) monitorImageContainers(ctx context.Context) { } } case common.KeyOperationExpired: - containerId := strings.TrimPrefix(is.keyEventManager.TrimKeyspacePrefix(event.Key), Keys.imageBuildContainerTTL("")) - is.builder.scheduler.Stop(&types.StopContainerArgs{ - ContainerId: containerId, - Force: true, - }) + if strings.Contains(event.Key, Keys.imageBuildContainerTTL("")) { + containerId := strings.TrimPrefix(is.keyEventManager.TrimKeyspacePrefix(event.Key), Keys.imageBuildContainerTTL("")) + is.builder.scheduler.Stop(&types.StopContainerArgs{ + ContainerId: containerId, + Force: true, + }) + } } case <-ctx.Done(): return