diff options
author | Richard Mudgett <rmudgett@digium.com> | 2016-08-02 13:53:35 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-08-11 11:59:08 -0500 |
commit | 9d4bd3d763635169751de02d44affbf574d8044e (patch) | |
tree | b76a225a659e48c65d8b22795dc22016a9ba75ff /main | |
parent | 1a3cc843718a35eb69168304c54ec9e7caec6ffd (diff) |
taskprocessor.c: Tweak high water checks.
* The high water check in ast_taskprocessor_alert_set_levels() would
trigger immediately if the new high water level is zero and the queue was
empty.
* The high water check in taskprocessor_push() was off by one.
Change-Id: I687729fb4efa6a0ba38ec9c1c133c4d407bc3d5d
Diffstat (limited to 'main')
-rw-r--r-- | main/taskprocessor.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/main/taskprocessor.c b/main/taskprocessor.c index 0c429cf3f..bbf282c27 100644 --- a/main/taskprocessor.c +++ b/main/taskprocessor.c @@ -608,7 +608,7 @@ int ast_taskprocessor_alert_set_levels(struct ast_taskprocessor *tps, long low_w tps_alert_add(tps, -1); } } else { - if (high_water <= tps->tps_queue_size) { + if (high_water < tps->tps_queue_size) { /* Update water mark alert immediately */ tps->high_water_alert = 1; tps_alert_add(tps, +1); @@ -883,11 +883,11 @@ static int taskprocessor_push(struct ast_taskprocessor *tps, struct tps_task *t) AST_LIST_INSERT_TAIL(&tps->tps_queue, t, list); previous_size = tps->tps_queue_size++; - if (previous_size >= tps->tps_queue_high) { + if (tps->tps_queue_high <= tps->tps_queue_size) { if (!tps->high_water_warned) { tps->high_water_warned = 1; - ast_log(LOG_WARNING, "The '%s' task processor queue reached %d scheduled tasks.\n", - tps->name, previous_size); + ast_log(LOG_WARNING, "The '%s' task processor queue reached %ld scheduled tasks.\n", + tps->name, tps->tps_queue_size); } if (!tps->high_water_alert) { tps->high_water_alert = 1; |