Thursday, June 1, 2017

Re: django channels group subscriptions

You should only use the documented, public groups API - anything else will vary based on the backend you use. You will, indeed, need your own expiration logic and backend for this process stuff - an easy entry point would be one of:

- A database row per process with a timestamp bumped using keepalive-style calls
- A redis key per process with an expiry bumped using keepalive-style calls

This will probably be the most reliable thing as keepalive means that even if you miss a disconnect event, it'll shut down eventually (the tradeoff being that you might miss several keepalives and then shut it down early)

Andrew

On Thu, Jun 1, 2017 at 9:26 PM, Brian May <brian@microcomaustralia.com.au> wrote:
On Friday, 2 June 2017 14:08:40 UTC+10, Andrew Godwin wrote:
I don't have any direct examples to hand - and this sort of thing does come all the time, but much like Django is not in the business of including a full CMS, Channels can't add lots of high-level features without really narrowing the usage - it's a general framework for you to build something on.

I am not sure I can how how to do this expiration myself.

inmemory.ChannelLayer has a _clean_expired() method that looks like it will look for all outgoing messages that haven't been sent before expiring. However it looks like my application, being a layer on top of groups doesn't have access to any of this information.

So maybe I need to put some sort of keep alive mechanism in place, and completely ignore this existing expiration mechanism?

Thanks

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3e22d613-29a3-4dc0-b99d-63db8616f7de%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFwN1upVJVdBhx9i6NkG84TNizP3ii5%3D5Uy156xuqivQuKO2Vg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment