Solution for worker warning and message not showing in redis as channel layer

I am using Django SyncConsumer to perform background task using http protocol referring this document Worker and Background Tasks — Channels 4.0.0 documentation. Also, i am sending data from Outside Consumer in Django Channels ( from view )

I have couple of questions.

  1. While running my worker i am getting below warning UserWarning: async_to_sync was passed a non-async-marked callable return AsyncToSync(
  2. My worker running fine after that and consumer receiving message but still there no message / channel name is showing in Redis, then how my consumer getting channel details from Channel layer.
  3. In consumer there will be just complex and time consuming business logic. in this case do i still need to connect, disconnect consumer, and stop consumer.

Please help.

  1. See Channels SyncConsumer base_send issue?

Basically, the conclusion is “don’t worry about it”.

(Responses to your other questions will come in a few minutes.)

  1. The keys you are looking for are transient, and only exist as long as necessary. If you run redis-cli MONITOR, you can see the redis commands being executed.

  2. Our consumers are much thinner than that. They’re all async, so they’re all running in basically one thread. The only functions performed by the consumers are the management of the websocket connection. All business logic is performed in the workers. That helps ensure that no request (or concurrent set of requests) can affect the overall throughput of those consumers.

Thank you so much Ken !! Appreciate your swift response.