#79 close django db connection before fork

The sentinel saves a statistic to the cache provider just before forking the workers. If this cache provider is a database backend, the connection stays open and gets forked and it crashes. Solution is to close any db connection before forking.
This commit is contained in:
Ilan Steemers
2015-09-29 10:47:22 +02:00
parent bcad7614b3
commit 1aed7c2d00

View File

@@ -188,6 +188,7 @@ class Sentinel(object):
def spawn_cluster(self):
self.pool = []
Stat(self).save()
db.connection.close()
# spawn worker pool
for __ in range(self.pool_size):
self.spawn_worker()