MCPcopy Index your code
hub / github.com/coder/coder / FinalizeStale

Method FinalizeStale

coderd/x/chatd/chatdebug/service.go:578–597  ·  view source on GitHub ↗

FinalizeStale finalizes stale in-flight debug rows and emits a broadcast.

(
	ctx context.Context,
)

Source from the content-addressed store, hash-verified

576
577// FinalizeStale finalizes stale in-flight debug rows and emits a broadcast.
578func (s *Service) FinalizeStale(
579 ctx context.Context,
580) (database.FinalizeStaleChatDebugRowsRow, error) {
581 now := s.clock.Now()
582 result, err := s.db.FinalizeStaleChatDebugRows(
583 chatdContext(ctx),
584 database.FinalizeStaleChatDebugRowsParams{
585 Now: now,
586 UpdatedBefore: now.Add(-s.staleThreshold()),
587 },
588 )
589 if err != nil {
590 return database.FinalizeStaleChatDebugRowsRow{}, err
591 }
592
593 if result.RunsFinalized > 0 || result.StepsFinalized > 0 {
594 s.publishEvent(ctx, uuid.Nil, EventKindFinalize, uuid.Nil, uuid.Nil)
595 }
596 return result, nil
597}
598
599// FinalizeRunParams bundles the arguments for FinalizeRun.
600type FinalizeRunParams struct {

Calls 5

staleThresholdMethod · 0.95
publishEventMethod · 0.95
chatdContextFunction · 0.85
AddMethod · 0.65