Skip to content

Commit 824ec53

Browse files
authored
Merge pull request #60 from codeGROOVE-dev/reliable
Extend context timeout from 15s to 60s
2 parents d58fbbc + edd5202 commit 824ec53

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

internal/bot/bot.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,11 +647,15 @@ func (c *Coordinator) handlePullRequestEventWithData(ctx context.Context, owner,
647647
// Send DMs asynchronously to avoid blocking event processing
648648
// SECURITY NOTE: Use detached context to allow graceful completion of DM notifications
649649
// even if parent context is cancelled during shutdown. Operations are still bounded by
650-
// explicit 15-second timeout, ensuring reasonably fast shutdown while handling slow API calls.
651-
// This pattern prevents incomplete DM delivery while maintaining shutdown security.
650+
// explicit 60-second timeout, allowing time for:
651+
// - GitHub email lookup via gh-mailto (~5-10s with retries/timeouts)
652+
// - Slack API user lookup for multiple guesses (~5-15s total)
653+
// - DM delivery (~1s)
654+
// This generous timeout prevents premature cancellation while still ensuring
655+
// eventual completion during shutdown. Most requests complete in <10s.
652656
// Note: No panic recovery - we want panics to propagate and restart the service (Cloud Run will handle it)
653657
// A quiet failure is worse than a visible crash that triggers automatic recovery
654-
dmCtx, dmCancel := context.WithTimeout(context.WithoutCancel(ctx), 15*time.Second)
658+
dmCtx, dmCancel := context.WithTimeout(context.WithoutCancel(ctx), 60*time.Second)
655659
go func() {
656660
defer dmCancel()
657661
c.sendDMNotifications(dmCtx, workspaceID, owner, repo, prNumber, uniqueUsers, event, prState, checkResult)

0 commit comments

Comments
 (0)