| 29 | } |
| 30 | |
| 31 | void CronTask_RecurringTask(void *pdata) { |
| 32 | ASSERT(pdata != NULL); |
| 33 | RecurringTaskCtx *current_ctx = (RecurringTaskCtx*)pdata; |
| 34 | bool speed_up = current_ctx->task(current_ctx->ctx); |
| 35 | |
| 36 | bool info_enabled = false; |
| 37 | if(Config_Option_get(Config_CMD_INFO, &info_enabled) && info_enabled) { |
| 38 | RecurringTaskCtx *re_ctx = rm_malloc(sizeof(RecurringTaskCtx)); |
| 39 | *re_ctx = *current_ctx; |
| 40 | re_ctx->ctx = re_ctx->new(re_ctx->ctx); |
| 41 | |
| 42 | // determine next invocation |
| 43 | if(speed_up) { |
| 44 | // reduce delay, lower limit: 250ms |
| 45 | re_ctx->when = (re_ctx->min_interval + re_ctx->when) / 2; |
| 46 | } else { |
| 47 | // increase delay, upper limit: 3sec |
| 48 | re_ctx->when = (re_ctx->max_interval + re_ctx->when) / 2; |
| 49 | } |
| 50 | |
| 51 | // re-add task to CRON |
| 52 | Cron_AddTask(re_ctx->when, CronTask_RecurringTask, CronTask_RecurringTaskFree, (void*)re_ctx); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | void CronTask_AddStreamFinishedQueries() { |
| 57 | //-------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected