Skip to content

Commit

Permalink
Fixed implicit close of synchronous engine at exit
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Jul 13, 2024
1 parent 528e3de commit 791b694
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/versionhistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ APScheduler, see the :doc:`migration section <migration>`.
``MongoDBDataStore``
- Fixed serialization error with ``CronTrigger`` when pausing a schedule
(`#923 <https://github.com/agronholm/apscheduler/issues/923>`_)
- Fixed ``TypeError: object NoneType can't be used in 'await' expression`` at teardown
of ``SQLAlchemyDataStore`` when it was passed a URL that implicitly created a
synchronous engine

**4.0.0a5**

Expand Down
5 changes: 4 additions & 1 deletion src/apscheduler/datastores/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,10 @@ async def start(
)

if self._close_on_exit:
exit_stack.push_async_callback(self._engine.dispose)
if isinstance(self._engine, AsyncEngine):
exit_stack.push_async_callback(self._engine.dispose)
else:
exit_stack.callback(self._engine.dispose)

await super().start(exit_stack, event_broker, logger)

Expand Down

0 comments on commit 791b694

Please sign in to comment.