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

Method DeleteAfterMessageID

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

DeleteAfterMessageID deletes debug data newer than the given message. The startedBefore bound scopes deletion to runs created before that instant so that retried cleanup does not remove runs created by a replacement turn that raced ahead of the retry window.

(
	ctx context.Context,
	chatID uuid.UUID,
	messageID int64,
	startedBefore time.Time,
)

Source from the content-addressed store, hash-verified

553// instant so that retried cleanup does not remove runs created by a
554// replacement turn that raced ahead of the retry window.
555func (s *Service) DeleteAfterMessageID(
556 ctx context.Context,
557 chatID uuid.UUID,
558 messageID int64,
559 startedBefore time.Time,
560) (int64, error) {
561 deleted, err := s.db.DeleteChatDebugDataAfterMessageID(
562 chatdContext(ctx),
563 database.DeleteChatDebugDataAfterMessageIDParams{
564 ChatID: chatID,
565 MessageID: messageID,
566 StartedBefore: startedBefore,
567 },
568 )
569 if err != nil {
570 return 0, err
571 }
572
573 s.publishEvent(ctx, chatID, EventKindDelete, uuid.Nil, uuid.Nil)
574 return deleted, nil
575}
576
577// FinalizeStale finalizes stale in-flight debug rows and emits a broadcast.
578func (s *Service) FinalizeStale(

Callers 2

EditMessageMethod · 0.80

Calls 3

publishEventMethod · 0.95
chatdContextFunction · 0.85

Tested by 1