Skip to content

Commit

Permalink
dispose stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Nov 5, 2024
1 parent 9ca886d commit 67bcbc1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cashu/core/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _is_lock_exception(e):
)
else:
logger.error(f"Error in session trial: {trial} ({random_int}): {e}")
raise e
raise
finally:
logger.trace(f"Closing session trial: {trial} ({random_int})")
await session.close()
Expand Down
2 changes: 1 addition & 1 deletion cashu/mint/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ async def _startup_ledger(self):
logger.info(f"Data dir: {settings.cashu_dir}")

async def shutdown_ledger(self):
await self.db.engine.dispose()
for task in self.invoice_listener_tasks:
task.cancel()
await self.db.engine.dispose()

async def _check_pending_proofs_and_melt_quotes(self):
"""Startup routine that checks all pending proofs for their melt state and either invalidates
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_mode = "strict"
asyncio_default_fixture_loop_scope = "function"

[tool.poetry.scripts]
Expand Down
1 change: 1 addition & 0 deletions tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ async def wallet():
)
await wallet.load_mint()
yield wallet
await wallet.db.engine.dispose()


@pytest.mark.asyncio
Expand Down

0 comments on commit 67bcbc1

Please sign in to comment.