Skip to content

Commit

Permalink
Adjust notification codes location
Browse files Browse the repository at this point in the history
See also: #17
  • Loading branch information
BECATRUE committed Dec 3, 2024
1 parent e4ed540 commit 6e93902
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions wlm_server/operation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,26 @@ def handle_info(request, ch: int):
if not util.is_wlm_running():
task_handler = TaskHandler()
task_handler.start()
if not util.is_channel_running(ch):
message = MessageInfo(ActionType.OPERATE, ch, {'on': True})
message_queue.push(message)
notif = {'on': True}
channel_layer = get_channel_layer()
async_to_sync(channel_layer.group_send)(
f'channel_{ch}', {'type': 'notify', 'message': json.dumps(notif)}
)
if not util.is_channel_running(ch):
message = MessageInfo(ActionType.OPERATE, ch, {'on': True})
message_queue.push(message)
operation.save()
else:
operation.save()
if not util.is_channel_running(ch):
message = MessageInfo(ActionType.OPERATE, ch, {'on': False})
message_queue.push(message)
if not util.is_wlm_running():
message = MessageInfo(ActionType.CLOSE, None, None)
message_queue.push(message)
notif = {'on': False}
channel_layer = get_channel_layer()
async_to_sync(channel_layer.group_send)(
f'channel_{ch}', {'type': 'notify', 'message': json.dumps(notif)}
)
if not util.is_wlm_running():
message = MessageInfo(ActionType.CLOSE, None, None)
message_queue.push(message)
return HttpResponse(status=200)

0 comments on commit 6e93902

Please sign in to comment.