mirror of
https://github.com/bunkerity/bunkerized-nginx
synced 2023-12-13 21:30:18 +01:00
Fix rare error when hashing dictionaries in the scheduler
This commit is contained in:
parent
1e62626ac0
commit
8231198219
1 changed files with 11 additions and 4 deletions
|
@ -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__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
# Don't execute if pid file exists
|
# Don't execute if pid file exists
|
||||||
|
@ -332,8 +339,8 @@ if __name__ == "__main__":
|
||||||
if saving:
|
if saving:
|
||||||
custom_configs.append(custom_conf)
|
custom_configs.append(custom_conf)
|
||||||
|
|
||||||
changes = changes or {hash(frozenset(d.items())) for d in custom_configs} != {
|
changes = changes or {hash(dict_to_frozenset(d)) for d in custom_configs} != {
|
||||||
hash(frozenset(d.items())) for d in db_configs
|
hash(dict_to_frozenset(d)) for d in db_configs
|
||||||
}
|
}
|
||||||
|
|
||||||
if changes:
|
if changes:
|
||||||
|
@ -381,8 +388,8 @@ if __name__ == "__main__":
|
||||||
external_plugin.pop("jobs", None)
|
external_plugin.pop("jobs", None)
|
||||||
tmp_external_plugins.append(external_plugin)
|
tmp_external_plugins.append(external_plugin)
|
||||||
|
|
||||||
changes = {hash(frozenset(d.items())) for d in tmp_external_plugins} != {
|
changes = {hash(dict_to_frozenset(d)) for d in tmp_external_plugins} != {
|
||||||
hash(frozenset(d.items())) for d in db_plugins
|
hash(dict_to_frozenset(d)) for d in db_plugins
|
||||||
}
|
}
|
||||||
|
|
||||||
if changes:
|
if changes:
|
||||||
|
|
Loading…
Reference in a new issue