Skip to content
Snippets Groups Projects
Commit 17e5bd8d authored by Arie Peterson's avatar Arie Peterson
Browse files

Coalesce multiple provisioning requests

parent 90a6ac4f
No related branches found
No related tags found
1 merge request!177Resolve "Extend SCIM to support Zulip"
Pipeline #45791 passed with stages
in 3 minutes and 49 seconds
......@@ -21,8 +21,22 @@ def request_provision():
try:
provisioning_queue.send("provision", timeout=0)
except BusyError:
# If we can't signal for some reason, silently fail.
# If we can't signal for some reason (queue limit reached), silently
# fail.
pass
def wait_provision():
# We first wait until there's any message in the queue.
provisioning_queue.receive()
# After that, we check if there are any more messages, to prevent a couple
# of (long) provisioning runs to be done back-to-back in case of multiple
# provisioning requests. Note however that if a request comes in during the
# middle of a provisioning run, we still do another one right after to make
# sure we propagate the latest changes right away.
try:
while True:
# We read with zero timeout, so we get an exception right away if
# the queue is empty.
provisioning_queue.receive(timeout=0)
except BusyError:
pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment