Skip to content

Commit

Permalink
Add two secs timeout
Browse files Browse the repository at this point in the history
Two sec timeout so there is enough time to check if there any message to read.
It was 0, too short for us to read the message.
  • Loading branch information
astrozzc committed Apr 5, 2024
1 parent 33ddeb2 commit 83cc6ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rbac/management/principal/cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def clean_principals_via_umb():
logger.info("clean_tenant_principals: Start principal clean up.")
UMB_CLIENT.connect()
UMB_CLIENT.subscribe(QUEUE, {StompSpec.ACK_HEADER: StompSpec.ACK_CLIENT_INDIVIDUAL})
while UMB_CLIENT.canRead(0): # Check if queue is empty
while UMB_CLIENT.canRead(2): # Check if queue is empty, two sec timeout
frame = UMB_CLIENT.receiveFrame()
data_dict = xmltodict.parse(frame.body)
is_deactivate = is_umb_deactivate_msg(data_dict)
Expand All @@ -186,6 +186,8 @@ def clean_principals_via_umb():
UMB_CLIENT.ack(frame)
continue
principal_name, groups = clean_principal_umb(data_dict)
if not groups:
logger.info(f"Principal {principal_name} was not under any groups.")
for tenant, group_names in groups.items():
logger.info(f"Principal {principal_name} was under tenant {tenant} in groups: {group_names}")
UMB_CLIENT.ack(frame) # This will remove the message from the queue
Expand Down

0 comments on commit 83cc6ab

Please sign in to comment.