mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-19 13:03:44 +00:00
always set SignalR events at the end of handlers (#445)
Addresses an issue where events meant for SignalR do not get sent to the service when an App Service instance spins down before a timer event fires.
This commit is contained in:
@ -7,10 +7,15 @@ import json
|
||||
|
||||
import azure.functions as func
|
||||
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.webhooks import WebhookMessageLog, WebhookMessageQueueObj
|
||||
|
||||
|
||||
def main(msg: func.QueueMessage) -> None:
|
||||
def main(msg: func.QueueMessage, dashboard: func.Out[str]) -> None:
|
||||
body = msg.get_body()
|
||||
obj = WebhookMessageQueueObj.parse_obj(json.loads(body))
|
||||
WebhookMessageLog.process_from_queue(obj)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
@ -1,12 +1,18 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "webhooks",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "webhooks",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user