1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-05 10:39:27 +02:00

fast first backoff retry, use seconds granularity

This commit is contained in:
B. Petersen 2018-11-21 15:02:51 +01:00
parent 7a88fb9536
commit cc1fdc5aa6
No known key found for this signature in database
GPG key ID: 3B88E92DEA8E9AFC

View file

@ -413,13 +413,13 @@ static void dc_suspend_smtp_thread(dc_context_t* context, int suspend)
static time_t get_backoff_time_offset(int c_tries)
{
#define MULTIPLY 60
#define JOB_RETRIES 16 // results in ~3 weeks for the last backoff timespan
#define JOB_RETRIES 17 // results in ~3 weeks for the last backoff timespan
int N = (int)pow((double)2, c_tries) - 1;
time_t N = (time_t)pow((double)2, c_tries - 1);
int r = rand() % (N+1);
N = N * MULTIPLY;
time_t seconds = r * MULTIPLY;
time_t seconds = rand() % (N+1);
if (seconds<1) {
seconds = 1;