Bogdanp / django_dramatiq

A Django app that integrates with Dramatiq.
https://dramatiq.io
Other
347 stars 77 forks source link

Delay app config initialization #101

Closed ashleybartlett closed 3 years ago

ashleybartlett commented 3 years ago

I was unable subclass DjangoDramatiqConfig to add a middleware_groupcallbacks_kwargs method so I can use the GroupCallbacks middleware as per the README, as the intitialize call was being called on import.

I've raised an issue for discussion https://github.com/Bogdanp/django_dramatiq/issues/100 though in some local testing, this just works. Let me know if there is some edge case reason this needs to be different and I can come up with an alternate solution.

According to the django docs on .ready() It is called as soon as the registry is fully populated, so this only delays the processing minorly. It no longer needs to use @classmethod everywhere, though this was a larger change, and I didn't fully understand the implications of changing it.

ashleybartlett commented 3 years ago

Yep this doesn't work. I had an extra .initialization() call in my code I missed. Working on something else to make this work.

ashleybartlett commented 3 years ago

This option was a bit naive and did not work.