[Asterisk-code-review] app_queue: Fix a few member pause bugs (...asterisk[16])
Sean Bright
asteriskteam at digium.com
Fri Mar 29 08:16:43 CDT 2019
Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11203
Change subject: app_queue: Fix a few member pause bugs
......................................................................
app_queue: Fix a few member pause bugs
* Always set member->lastpause when setting member->paused
* Fixed typo (using member->lastcall instead of member->lastpause) in
'queue show' output.
* Use a constant 'now' in 'queue show' output for a better point-in-time
view of time based stats.
ASTERISK-27541 #close
Reported by: César Benjamín García Martínez
Change-Id: Ib41ced90cfdb66f9bb1e7b263d0f6fc1ac6e18fa
---
M apps/app_queue.c
1 file changed, 11 insertions(+), 8 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/03/11203/1
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 2ad468d..6cda3b3 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -3463,6 +3463,9 @@
ast_copy_string(m->rt_uniqueid, rt_uniqueid, sizeof(m->rt_uniqueid));
if (paused_str) {
m->paused = paused;
+ if (paused) {
+ time(&m->lastpause); /* XXX: Should this come from realtime? */
+ }
ast_devstate_changed(m->paused ? QUEUE_PAUSED_DEVSTATE : QUEUE_UNPAUSED_DEVSTATE,
AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", q->name, m->interface);
}
@@ -9749,14 +9752,14 @@
mem->dynamic ? ast_term_color(COLOR_CYAN, COLOR_BLACK) : "", mem->dynamic ? " (dynamic)" : "", ast_term_reset(),
mem->realtime ? ast_term_color(COLOR_MAGENTA, COLOR_BLACK) : "", mem->realtime ? " (realtime)" : "", ast_term_reset(),
mem->starttime ? ast_term_color(COLOR_BROWN, COLOR_BLACK) : "", mem->starttime ? " (in call)" : "", ast_term_reset());
+
if (mem->paused) {
- if (ast_strlen_zero(mem->reason_paused)) {
- ast_str_append(&out, 0, " %s(paused was %ld secs ago)%s",
- ast_term_color(COLOR_BROWN, COLOR_BLACK), (long) (time(NULL) - mem->lastpause), ast_term_reset());
- } else {
- ast_str_append(&out, 0, " %s(paused:%s was %ld secs ago)%s", ast_term_color(COLOR_BROWN, COLOR_BLACK),
- mem->reason_paused, (long) (time(NULL) - mem->lastcall), ast_term_reset());
- }
+ ast_str_append(&out, 0, " %s(paused%s%s was %ld secs ago)%s",
+ ast_term_color(COLOR_BROWN, COLOR_BLACK),
+ ast_strlen_zero(mem->reason_paused) ? "" : ":",
+ ast_strlen_zero(mem->reason_paused) ? "" : mem->reason_paused,
+ (long) (now - mem->lastpause),
+ ast_term_reset());
}
ast_str_append(&out, 0, " (%s%s%s)",
@@ -9766,7 +9769,7 @@
ast_devstate2str(mem->status), ast_term_reset());
if (mem->calls) {
ast_str_append(&out, 0, " has taken %d calls (last was %ld secs ago)",
- mem->calls, (long) (time(NULL) - mem->lastcall));
+ mem->calls, (long) (now - mem->lastcall));
} else {
ast_str_append(&out, 0, " has taken no calls yet");
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11203
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ib41ced90cfdb66f9bb1e7b263d0f6fc1ac6e18fa
Gerrit-Change-Number: 11203
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190329/a49cacdf/attachment-0001.html>
More information about the asterisk-code-review
mailing list