Skip to content

Commit de6b5a5

Browse files
bramweltclaude
andcommitted
fix: use detached context for CreateMember rollback
When an HTTP client times out mid-request (e.g. the v1-sync-helper's 30 s http.Client.Timeout under onboarding load), the committee-service request context is cancelled. The deferred rollback in CreateMember was calling deleteMemberKeys with that cancelled context, causing every NATS KV cleanup call to fail immediately. The uniqueness key written by UniqueMember (step 7) was left orphaned, blocking future create attempts for the same email+committee pair with a spurious 409 Conflict. Fix: use context.WithTimeout(context.Background(), 10s) for the rollback, matching the pattern already used by UpdateMember for its stale-key cleanup goroutine. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Issue: LFXV2-2984 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
1 parent 4747b11 commit de6b5a5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

internal/service/committee_member_writer.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ func (uc *committeeWriterOrchestrator) CreateMember(ctx context.Context, member
101101
)
102102
defer func() {
103103
if err := recover(); err != nil || rollbackRequired {
104-
uc.deleteMemberKeys(ctx, keys, rollbackRequired)
104+
cleanupCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
105+
defer cancel()
106+
uc.deleteMemberKeys(cleanupCtx, keys, rollbackRequired)
105107
}
106108
}()
107109

0 commit comments

Comments
 (0)