feat: harden multi-host runtime coordination
This commit is contained in:
@@ -166,9 +166,7 @@ def runtime_identity(
|
||||
for item in str(getattr(settings, "celery_queues", "") or "").split(",")
|
||||
if item.strip()
|
||||
)
|
||||
composition_hash = hashlib.sha256(
|
||||
json.dumps(sorted(module_ids), separators=(",", ":")).encode("utf-8")
|
||||
).hexdigest()
|
||||
composition_hash = runtime_composition_hash(module_ids)
|
||||
return RuntimeIdentity(
|
||||
installation_id=installation_id,
|
||||
node_id=effective_node_id,
|
||||
@@ -180,6 +178,12 @@ def runtime_identity(
|
||||
)
|
||||
|
||||
|
||||
def runtime_composition_hash(module_ids: tuple[str, ...]) -> str:
|
||||
return hashlib.sha256(
|
||||
json.dumps(sorted(set(module_ids)), separators=(",", ":")).encode("utf-8")
|
||||
).hexdigest()
|
||||
|
||||
|
||||
def register_runtime_node(
|
||||
session: Session,
|
||||
identity: RuntimeIdentity,
|
||||
|
||||
Reference in New Issue
Block a user