How to lock django commands so it will not run twise in the same time?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create a lock somewhere – I recently saw very simple lock implementation that used cache:
It’s just one of many possible implementations.
Edit: Corrected, I just pasted code without thinking.
try...finallyblock is used to ensure that lock is always released, no matter what happens – but of courseifstatement is also necessary.