Fix rare error when hashing dictionaries in the scheduler

This commit is contained in:
Théophile Diot 2023-06-21 09:46:56 -04:00
parent 1e62626ac0
commit 8231198219
No known key found for this signature in database
GPG Key ID: E752C80DB72BB014
1 changed files with 11 additions and 4 deletions

View File

@ -169,6 +169,13 @@ def generate_external_plugins(
)
def dict_to_frozenset(d):
if isinstance(d, dict):
return frozenset((k, dict_to_frozenset(v)) for k, v in d.items())
else:
return d
if __name__ == "__main__":
try:
# Don't execute if pid file exists
@ -332,8 +339,8 @@ if __name__ == "__main__":
if saving:
custom_configs.append(custom_conf)
changes = changes or {hash(frozenset(d.items())) for d in custom_configs} != {
hash(frozenset(d.items())) for d in db_configs
changes = changes or {hash(dict_to_frozenset(d)) for d in custom_configs} != {
hash(dict_to_frozenset(d)) for d in db_configs
}
if changes:
@ -381,8 +388,8 @@ if __name__ == "__main__":
external_plugin.pop("jobs", None)
tmp_external_plugins.append(external_plugin)
changes = {hash(frozenset(d.items())) for d in tmp_external_plugins} != {
hash(frozenset(d.items())) for d in db_plugins
changes = {hash(dict_to_frozenset(d)) for d in tmp_external_plugins} != {
hash(dict_to_frozenset(d)) for d in db_plugins
}
if changes: