mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
prefix worker tmpfile and make sure we delete them when closing the
worker
This commit is contained in:
parent
e47f470a38
commit
2090bc1a04
@ -379,6 +379,7 @@ class Arbiter(object):
|
||||
self.log.info("Worker %s exiting." % worker_pid)
|
||||
try:
|
||||
worker.tmp.close()
|
||||
os.unlink(worker.tmpname)
|
||||
except:
|
||||
pass
|
||||
|
||||
@ -402,6 +403,7 @@ class Arbiter(object):
|
||||
worker = self.WORKERS.pop(pid)
|
||||
try:
|
||||
worker.tmp.close()
|
||||
os.unlink(worker.tmpname)
|
||||
except:
|
||||
pass
|
||||
raise
|
||||
|
||||
@ -34,9 +34,9 @@ class Worker(object):
|
||||
self.debug = debug
|
||||
self.socket = socket
|
||||
self.timeout = timeout
|
||||
self.fd, tmpname = tempfile.mkstemp()
|
||||
self.fd, self.tmpname = tempfile.mkstemp(prefix="wgunicorn-")
|
||||
self.tmp = os.fdopen(self.fd, "r+b")
|
||||
self.tmpname = tmpname
|
||||
print self.tmpname
|
||||
self.app = app
|
||||
self.alive = True
|
||||
self.log = logging.getLogger(__name__)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user