mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
This change add proper file locking to gunicorn. By default "gunicorn.lock" is created in the temporary directory when a unix socket is bound. In case someone want to fix the lock file path or use multiple gunicorn instance the "--lock-file" setting can be used to set the path of this file. fix #1259
16 lines
446 B
Python
16 lines
446 B
Python
import os
|
|
|
|
from gunicorn.lockfile import LockFile
|
|
from gunicorn.util import tmpfile
|
|
|
|
def test_lockfile():
|
|
lockname = tmpfile(prefix="gunicorn-tests", suffix=".lock")
|
|
lock_file = LockFile(lockname)
|
|
assert lock_file.locked() == False
|
|
assert os.path.exists(lockname)
|
|
lock_file.lock()
|
|
assert lock_file.locked() == True
|
|
lock_file.unlock()
|
|
assert lock_file.locked() == False
|
|
assert os.path.exists(lockname) == False
|