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 Nov 22, 2024
1 parent 9c3d698 commit 4d716dd
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 @@ -48,27 +48,27 @@ def handle_info(request, ch: int):
if not is_wlm_running:
task_handler = TaskHandler()
task_handler.start()
if not is_channel_running:
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 is_channel_running:
message = MessageInfo(ActionType.OPERATE, ch, {'on': True})
message_queue.push(message)
operation.save()
else:
operation.save()
is_wlm_running, is_channel_running = get_running_status(ch)
if not is_channel_running:
message = MessageInfo(ActionType.OPERATE, ch, {'on': False})
message_queue.push(message)
if not 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 is_wlm_running:
message = MessageInfo(ActionType.CLOSE, None, None)
message_queue.push(message)
return HttpResponse(status=200)

0 comments on commit 4d716dd

Please sign in to comment.