Skip to content

Commit 694a258

Browse files
authored
Close database for non-reporting commands (Fixes #860) (#865)
* Close database for non-reporting commands (Fixes #860) This avoids warnings like this one: <sys>:0: ResourceWarning: unclosed database in <sqlite3.Connection object at 0x...> Thanks to Hanno Böck for reporting.
1 parent 36c810d commit 694a258

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The format mostly follows [Keep a Changelog](http://keepachangelog.com/en/1.0.0/
2020
- Fix shell reporter running even when diff is empty (#837, by MarcPer)
2121
- Filter for gitlab.com tags fixed (#839, by julianuu)
2222
- Fix `TypeError` when jobs don't have tags (#843 by Maxime Werlen)
23+
- Fix `ResourceWarning` when running non-reporting commands (#865, reported by Hanno Böck)
2324

2425
## [2.29] -- 2024-10-28
2526

lib/urlwatch/command.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,13 @@ def check_xmpp_login(self):
485485
sys.exit(0)
486486

487487
def run(self):
488-
self.check_edit_config()
489-
self.check_smtp_login()
490-
self.check_telegram_chats()
491-
self.check_xmpp_login()
492-
self.check_test_reporter()
493-
self.handle_actions()
494-
self.urlwatcher.run_jobs()
495-
self.urlwatcher.close()
488+
try:
489+
self.check_edit_config()
490+
self.check_smtp_login()
491+
self.check_telegram_chats()
492+
self.check_xmpp_login()
493+
self.check_test_reporter()
494+
self.handle_actions()
495+
self.urlwatcher.run_jobs()
496+
finally:
497+
self.urlwatcher.close()

lib/urlwatch/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def load_jobs(self):
107107

108108
def run_jobs(self):
109109
run_jobs(self)
110+
self.report.finish()
110111

111112
def close(self):
112-
self.report.finish()
113113
self.cache_storage.close()

0 commit comments

Comments
 (0)