Skip to content

Circuit Breaker causes parallel requests to execute sequentially #2889

@gourish25

Description

@gourish25

Describe the bug
When the circuit breaker is enabled, HTTP requests that normally execute in parallel start behaving sequentially.

For example, Without the circuit breaker, two simultaneous requests complete in ~10 seconds total. After enabling the circuit breaker, the same two requests take ~20 seconds total, indicating that the second request waits for the first one to finish.

To Reproduce
Steps to reproduce the behavior, if applicable:

  1. The code is

    &gofrService.CircuitBreakerConfig{Threshold: 6, Interval: 5 * time.Second}

Screenshots

1️⃣ Without Circuit Breaker (Parallel Execution)

Without CB

2️⃣ With Circuit Breaker Enabled (Sequential Execution)

With CB

First Image (without CB): Both requests complete in ~10s and total time is ~10s, confirming parallel execution.
Second Image (with CB): One request completes at ~10s and the other at ~20s, total time ~20s, showing the circuit breaker caused sequential execution.

**Environments **

  • gofr version 1.25.0
  • go version 1.54.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions