Skip to content

Commit

Permalink
[IMP] queue_job: make sorting more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul authored and qgroulard committed Jul 18, 2024
1 parent 5a24b5a commit 918a966
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions queue_job/jobrunner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def get_db_names(self):
db_names = config["db_name"].split(",")
else:
db_names = odoo.service.db.list_dbs(True)
return sorted(db_names)
return db_names

def close_databases(self, remove_jobs=True):
for db_name, db in self.db_by_name.items():
Expand All @@ -433,7 +433,8 @@ def close_databases(self, remove_jobs=True):
self.db_by_name = {}

def initialize_databases(self):
for db_name in self.get_db_names():
for db_name in sorted(self.get_db_names()):
# sorting is important to avoid deadlocks in acquiring the master lock
db = Database(db_name)
if db.has_queue_job:
self.db_by_name[db_name] = db
Expand Down

0 comments on commit 918a966

Please sign in to comment.