Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Trying to unblock at most every POLL_SECONDS to force container processing
- if pipe_end.poll(POLL_SECONDS) == True:
- # New data has been received -> recv() and then manage it!
- counter = 0
- # ...
- amqp_blk_sender.send(received_data);
- else:
- try:
- amqp_blk_conn.wait(lambda: False,timeout=0.01)
- except:
- # Increase a counter
- counter += 1
- finally:
- # If no data was available for a long time, we can close the connection
- if counter > MAX_WAIT:
- amqp_blk_conn.close()
- # Clean-up and end loop waiting for new data and sending it via AMQP
Advertisement
Add Comment
Please, Sign In to add comment