Skip to content

Commit

Permalink
force channel layer to be empty
Browse files Browse the repository at this point in the history
since the version 4 of channel redis version, the channel layer is not
empty after the first read

we read it again to empty it

maybe it is related to
django/channels_redis#348
or to django/channels_redis#366
  • Loading branch information
clavay committed May 17, 2023
1 parent c0607f8 commit 949baac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pyscada/utils/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,12 @@ async def waiting_action_receiver(self, dt, message):
self.dwt_received = True
if 'ProcessSignal' in a:
logger.debug("Received ProcessSignal %s on channel_layer for %s" % (a['ProcessSignal'], self.label))
#logger.debug(a)

# BUG : need to empty the channel_layer, if not the channel layer keep the message for each run loop
try:
await wait_for(self.channel_layer.receive(message), timeout=0.01)
except asyncioTimeoutError:
pass
else:
#logger.debug("sleep for %s - %s" % (self.process_id, dt))
sleep(dt)
Expand Down

0 comments on commit 949baac

Please sign in to comment.