22 lines
488 B
Python
22 lines
488 B
Python
# events/failure_stream.py
|
|
|
|
import asyncio
|
|
import json
|
|
|
|
class FailureStream:
|
|
|
|
def __init__(self, ws_broadcaster, propagation_engine):
|
|
self.ws = ws_broadcaster
|
|
self.propagation = propagation_engine
|
|
|
|
async def emit_failure(self, failed_node):
|
|
|
|
map_result = self.propagation.map_failure(failed_node)
|
|
|
|
payload = {
|
|
"type": "failure_propagation",
|
|
"data": map_result
|
|
}
|
|
|
|
await self.ws.broadcast(json.dumps(payload))
|