Working on making things more reliable... WS and DB connections
This commit is contained in:
@@ -104,7 +104,8 @@ async def redis_connector(
|
||||
|
||||
# WARNING: If the timeout is not defined in the function call to something greater than 0 (the default if not set?) or None, the get_message() method will cause high CPU usage and or just not work. Or at least that specific thread will just hang. This is because the timeout is set to 0. This is not the same as None.
|
||||
# The get_message() method is a blocking method (timeout=None) that waits for a message to be published to the channel. This seems to be a good solution for now. The other option is to set a timeout of something like 1 second or .01 seconds to do other things (like send a heartbeat after each timeout).
|
||||
message = await r_channel.get_message(ignore_subscribe_messages=True, timeout=None) # Timeout should be None. Other options are something like: 1 second, .1 seconds, or .01 seconds
|
||||
# message = await r_channel.get_message(ignore_subscribe_messages=True, timeout=None) # Timeout should be None. Other options are something like: 1 second, .1 seconds, or .01 seconds
|
||||
message = await r_channel.get_message(ignore_subscribe_messages=True, timeout=.1) # Timeout should be None. Other options are something like: 1 second, .1 seconds, or .01 seconds
|
||||
log.debug(f'(Redis Reader) Message received or timeout reached: {message}')
|
||||
if message is not None:
|
||||
log.debug(f'(Redis Reader) Message Received: {message}')
|
||||
|
||||
Reference in New Issue
Block a user