From 1174759f0c6ecc612fc708b0554923bbc7493ee7 Mon Sep 17 00:00:00 2001
From: lvl <digium@lvlconsultancy.nl>
Date: Mon, 3 Sep 2018 13:28:26 +0200
Subject: [PATCH] app_queue: Update realtime queuemembers after wait_a_bit(),
 not before

This ensures the most up-to-date information is used for the next
call attempt.

ASTERISK-28032

Change-Id: I02fc17c6ffb50bb60ea97c2d2e6023e8061815ce
---
 apps/app_queue.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/apps/app_queue.c b/apps/app_queue.c
index 136dec59c0..7b05133f07 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -8444,14 +8444,15 @@ check_turns:
 			break;
 		}
 
-		/* If using dynamic realtime members, we should regenerate the member list for this queue */
-		update_realtime_members(qe.parent);
 		/* OK, we didn't get anybody; wait for 'retry' seconds; may get a digit to exit with */
 		res = wait_a_bit(&qe);
 		if (res) {
 			goto stop;
 		}
 
+		/* If using dynamic realtime members, we should regenerate the member list for this queue */
+		update_realtime_members(qe.parent);
+
 		/* Since this is a priority queue and
 		 * it is not sure that we are still at the head
 		 * of the queue, go and check for our turn again.
-- 
GitLab