Skip to content

fix: remove chaos-injected Thread.sleep from CreditCardService#66

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-chaos-injected-response-delay
Draft

fix: remove chaos-injected Thread.sleep from CreditCardService#66
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-chaos-injected-response-delay

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

Azure Monitor Sev3 alert fired due to a chaos-engineering Thread.sleep left in the getAllCreditCards() hot path, injecting 0–10s random delays on every GET /api/cards request.

Change

Removed the chaos injection from CreditCardService.getAllCreditCards():

// removed
try { Thread.sleep((long)(Math.random() * 10000)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }

The method now returns directly from the H2 query with no artificial delay, restoring expected P95 latency (<200ms).


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Fix chaos-injected Thread.sleep in CreditCardService fix: remove chaos-injected Thread.sleep from CreditCardService Mar 23, 2026
Copilot AI requested a review from yortch March 23, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ca-banking-demo-backend] High P95 Response Time — Chaos-Injected Thread.sleep in CreditCardService | Sev3 | 2026-03-23

2 participants