Skip to content

Commit 7be5028

Browse files
committed
Close the sessions before disposing the engines as the engines won't close connections held up in sessions.
1 parent 688c3fe commit 7be5028

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

celery/backends/database/session.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ class _after_fork(object):
2929

3030
def __call__(self):
3131
self.registered = False # child must reregister
32+
for session in _SESSIONS:
33+
session.close()
34+
_SESSIONS.clear()
3235
for engine in list(_ENGINES.values()):
3336
engine.dispose()
3437
_ENGINES.clear()
35-
_SESSIONS.clear()
3638
after_fork = _after_fork()
3739

3840

0 commit comments

Comments
 (0)