trying some kind of "no route" message… maybe

This commit is contained in:
Laura Klünder 2023-10-06 02:58:43 +02:00
parent b732d52f65
commit f049499637
2 changed files with 5 additions and 3 deletions

View file

@ -145,11 +145,11 @@ class MeshConsumer(WebsocketConsumer):
"channel": self.channel_name,
"dst": msg.src,
})
send_channel_msg.apply_async(self.channel_name, {
send_channel_msg.apply_async((self.channel_name, {
"type": "mesh.no_route_response",
"request_id": msg.request_id,
"dst": msg.src,
}, countdown=5)
}), countdown=5)
def mesh_uplink_consumer(self, data):
# message handler: if we are not the given uplink, leave this group

View file

@ -1,3 +1,4 @@
import channels
from asgiref.sync import async_to_sync
from c3nav.celery import app
@ -5,5 +6,6 @@ from c3nav.celery import app
@app.task(bind=True, max_retries=3)
def send_channel_msg(self, layer, msg):
# todo: this is… not ideal, is it?
print("task sending channel msg...")
async_to_sync(self.channel_layer.send)(layer, msg)
async_to_sync(channels.layers.get_channel_layer().send)(layer, msg)