How to lock a critical section in Django?

前端 未结 6 1479
礼貌的吻别
礼貌的吻别 2020-12-02 14:49

I can\'t find a good clean way to lock a critical section in Django. I could use a lock or semaphore but the python implementation is for threads only, so if the production

6条回答
  •  执笔经年
    2020-12-02 15:36

    You need a distributed lock manager at the point where your app suddenly needs to run on more than one service. I wrote elock for this purpose. There are bigger ones and others have chosen to ignore every suggestion and done the same with memcached.

    Please don't use memcached for anything more than light advisory locking. It is designed to forget stuff.

    I like to pretend like filesystems don't exist when I'm making web apps. Makes scale better.

提交回复
热议问题