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:
bmc-msft
2021-01-21 05:31:02 -05:00
committed by GitHub
parent f3d81566e3
commit b499b9b17d
55 changed files with 708 additions and 414 deletions

View File

@ -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)

View File

@ -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"
}
]
}