Guest User

Untitled

a guest
Jul 17th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. # Trying to unblock at most every POLL_SECONDS to force container processing
  2. if pipe_end.poll(POLL_SECONDS) == True:
  3.             # New data has been received -> recv() and then manage it!
  4.             counter = 0
  5.             # ...
  6.             amqp_blk_sender.send(received_data);
  7.         else:
  8.             try:
  9.                 amqp_blk_conn.wait(lambda: False,timeout=0.01)
  10.             except:
  11.                 # Increase a counter
  12.                 counter += 1
  13.             finally:
  14.                 # If no data was available for a long time, we can close the connection
  15.                 if counter > MAX_WAIT:
  16.                     amqp_blk_conn.close()
  17.                     # Clean-up and end loop waiting for new data and sending it via AMQP
Advertisement
Add Comment
Please, Sign In to add comment