Friday, June 22, 2018

Re: prevent AppConfig.ready() from running twice

Is there a python singleton pattern which might work?

Connected by Motorola


Melvyn Sopacua <m.r.sopacua@gmail.com> wrote:

On donderdag 21 juni 2018 16:23:23 CEST clavierplayer@gmail.com wrote:

> If it helps, here is the reason I need to override this multi-instantiation
> behavior: my application launches a multiprocessing.Process at startup to
> monitor and run background tasks. Having more than one background Process
> running at once is going to wreak havoc on the application. I've looked at
> other options to accomplish similar purposes, but those would all be
> instantiated multiple times, also.
>
> Any suggestions?

Use a locked pidfile to prevent multiple daemons starting up. I recall the
python-daemon package being capable of this (and lots of other good stuff).

https://pagure.io/python-daemon/
--
Melvyn Sopacua

--
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/139066525.eYAS18T7Ez%40fritzbook.
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/wb0bbtt2xa79lb1b10sny7md.1529712066075%40email.android.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment