Skip to content

Commit

Permalink
be_ptask: backoff not applied on first re-schedule
Browse files Browse the repository at this point in the history
The task interval backoff is not applied on the first re-schedule
operation, since when scheduling the first run (BE_PTASK_FIRST_DELAY)
we do not calculate the backed off period for the next re-schedule.

Calculate the backed off period for the current scheduling operation,
rather than the next, to resolve this.
  • Loading branch information
deastoe committed Jul 21, 2020
1 parent c572bbf commit eebb19e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/providers/be_ptask.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ static void be_ptask_schedule(struct be_ptask *task,
return;
}

delay = task->period;

if (backoff_allowed(task)) {
/* double the period for the next execution */
task->period = MIN(task->period * 2, task->max_backoff);
}

delay = task->period;
break;
}

Expand Down

0 comments on commit eebb19e

Please sign in to comment.