Skip to content

ENV['RACK_ENV'] == 'test' silently disables retry backoff in BazaRb#attempt #358

Description

@VasilevNStas

ENV["RACK_ENV"] == "test" silently disables retry backoff in BazaRb#attempt

Severity: MEDIUM

Location

lib/baza-rb.rb:629,654:

sleep(seconds) unless ENV["RACK_ENV"] == "test"

Problem

Retry backoff is globally controlled by an environment variable. Three issues:

  1. Hidden behavior: Any code setting RACK_ENV=test (or RAILS_ENV=test, or APP_ENV=test) disables backoff
  2. Inconsistency: Production behavior is controlled by an undocumented env var
  3. Untestable: Backoff logic cannot be tested (it is disabled in tests)

Recommended fix

Parameterize via constructor:

def initialize(..., backoff: true)
  @backoff = backoff
end

Then in tests: BazaRb.new(..., backoff: false). This makes the behavior explicit and testable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions