Skip to content

Commit 81e4eb1

Browse files
author
James William Pye
committed
Don't interrupt and close if it's already closed.
1 parent 1d6da9d commit 81e4eb1

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

postgresql/temporal.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,10 @@ def pop(self,
205205
__builtins__.pop(x, None)
206206
if not interrupt:
207207
# Interrupt then close. Just in case something is lingering.
208-
builtins['db'].interrupt()
209-
builtins['db'].close()
210-
for x in extras:
211-
x.interrupt()
212-
x.close()
208+
for x in [builtins['db']] + list(extras):
209+
if not x.closed:
210+
x.interrupt()
211+
x.close()
213212
# Interrupted and closed all the other connections.
214213
with builtins['new']() as dropdb:
215214
dropdb.execute(drop_schema(self.sandbox_id+1))

0 commit comments

Comments
 (0)