Skip to content

Commit

Permalink
chore: delete synchronous runs that don't have a state after 12 hours
Browse files Browse the repository at this point in the history
Signed-off-by: Donnie Adams <[email protected]>
  • Loading branch information
thedadams committed Jan 14, 2025
1 parent 359397e commit 03fdf80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/controller/handlers/runs/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 03fdf80

Please sign in to comment.