Commit 2c0b68d8 authored by Piotr Batko's avatar Piotr Batko
Browse files

Simplify loop and fix off-by-one error with unneeded sleep

When this loop is executed, its counter goes from max_attempts, let's say 3 to 0
(2, 1, 0). Before each try of resending message were entered sleep, to not send
all retries in almost same moment. So expected behavior was:
- first try (2 attempts left, previously were 3)
- failed, so sleep...
- second try (1 attempts left, previously were 2)
- failed, so sleep...
- third try (0 attempts left, previously were 1)
- failed, but there is no more attempts left (previously was 1), so immediately
  raise exception, without sleep.

Previous code version, because of bug, unnecessary waited before raising exception.
parent af0381bd
Loading
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment