Skip to content

Commit

Permalink
[postgres] dont dispose engine in watch thread (#7241)
Browse files Browse the repository at this point in the history
  • Loading branch information
alangenfeld committed Mar 30, 2022
1 parent ff9596f commit e66faf9
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,18 +313,15 @@ def watcher_thread(
with dict_lock:
handlers = handlers_dict.get(run_id, [])

try:
with engine.connect() as conn:
cursor_res = conn.execute(
db.select([SqlEventLogStorageTable.c.event]).where(
SqlEventLogStorageTable.c.id == index
),
)
dagster_event: EventLogEntry = deserialize_json_to_dagster_namedtuple(
cursor_res.scalar()
)
finally:
engine.dispose()
with engine.connect() as conn:
cursor_res = conn.execute(
db.select([SqlEventLogStorageTable.c.event]).where(
SqlEventLogStorageTable.c.id == index
),
)
dagster_event: EventLogEntry = deserialize_json_to_dagster_namedtuple(
cursor_res.scalar()
)

for callback_with_cursor in handlers:
if callback_with_cursor.start_cursor < index:
Expand Down

0 comments on commit e66faf9

Please sign in to comment.