-
Notifications
You must be signed in to change notification settings - Fork 27
Django DB Mutex #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@jaredlewis @joshmarlow this is the solution for django mutex locking. Look it over and let me know if you have any concerns or suggestions. Would like to deploy this for our celery jobs today. |
README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: in practice and in example, we should decorate this with @abc.abstract method. The advantage is that we will get an error even trying to instantiate subclasses that do not override this; the NotImplementedError will only throw an exception when we try to call run_worker (which would not occur if we accidentally override run).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i agree with josh, I would try to use the abstract class. Also with this could we just put the decorator on the run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I was aware of the abc thing, but I just used this as a quick example. I'll update it to use abc here in the docs though
@wesleykendall I had a few suggestions. Looks great to me 🐫 One final thought: perhaps create a testing script to test it under load; create lots of threads/processes that all try in parallel to create the same lock to generate an error? Haven't thought it out in any great detail... |
@wesleykendall this looks amazing. Very well done |
🐗 |
The first version of getting a mutex lock from the DB in Django