Skip to content

Remove Thread.sleep chaos injection from CreditCardService#102

Merged
yortch merged 2 commits into
mainfrom
copilot/fix-backend-latency-degradation
May 15, 2026
Merged

Remove Thread.sleep chaos injection from CreditCardService#102
yortch merged 2 commits into
mainfrom
copilot/fix-backend-latency-degradation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

CreditCardService.getAllCreditCards() contained an undocumented chaos line introducing up to 9 seconds of random latency on every invocation, causing backend response time degradation in production.

Change

  • CreditCardService.java — removed the sleep injection:
    // Removed:
    try { Thread.sleep((long)(Math.random() * 9000)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
    getAllCreditCards() now executes the H2 query and DTO mapping directly with no artificial delay.

Copilot AI changed the title [WIP] Fix backend latency degradation due to deployment-induced cold start Remove Thread.sleep chaos injection from CreditCardService May 15, 2026
Copilot AI requested a review from yortch May 15, 2026 17:46
Copilot finished work on behalf of yortch May 15, 2026 17:46
@yortch yortch marked this pull request as ready for review May 15, 2026 17:47
Copilot AI review requested due to automatic review settings May 15, 2026 17:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes an artificial random delay from CreditCardService.getAllCreditCards(), restoring direct H2-backed retrieval and DTO mapping for the card catalog endpoint.

Changes:

  • Removed undocumented Thread.sleep latency injection from getAllCreditCards().
  • Preserved existing read-only transaction behavior and repository-to-DTO mapping.
Show a summary per file
File Description
backend/src/main/java/com/threeriversbank/service/CreditCardService.java Removes artificial random latency before fetching all credit cards from H2.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@yortch yortch merged commit 1b09327 into main May 15, 2026
5 checks passed
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.

Backend Latency Degradation — Deployment-Induced Cold Start (2026-05-15T17:25Z)

3 participants