From 03fdf8088bf4ce562144cc51b4c2e8361f3115ab Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Tue, 14 Jan 2025 14:15:15 -0500 Subject: [PATCH] chore: delete synchronous runs that don't have a state after 12 hours Signed-off-by: Donnie Adams --- pkg/controller/handlers/runs/runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/controller/handlers/runs/runs.go b/pkg/controller/handlers/runs/runs.go index 6078cad3f..43abc8634 100644 --- a/pkg/controller/handlers/runs/runs.go +++ b/pkg/controller/handlers/runs/runs.go @@ -72,7 +72,7 @@ func (h *Handler) Resume(req router.Request, _ router.Response) error { func (h *Handler) DeleteFinished(req router.Request, _ router.Response) error { run := req.Object.(*v1.Run) - if run.Status.State == gptscript.Finished && time.Since(run.Status.EndTime.Time) > 12*time.Hour { + if run.Status.State == gptscript.Finished && time.Since(run.Status.EndTime.Time) > 12*time.Hour || (run.Spec.Synchronous && run.Status.State == "" && time.Since(run.CreationTimestamp.Time) > 12*time.Hour) { // These will be system tasks. Everything is a chat and finished with Continue status return req.Delete(run) }