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:
@ -12,6 +12,7 @@ from onefuzztypes.requests import ProxyCreate, ProxyDelete, ProxyGet, ProxyReset
|
||||
from onefuzztypes.responses import BoolResult, ProxyGetResult
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.pools import Scaleset
|
||||
from ..onefuzzlib.proxy import Proxy
|
||||
from ..onefuzzlib.proxy_forward import ProxyForward
|
||||
@ -114,7 +115,13 @@ def delete(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(BoolResult(result=True))
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post, "DELETE": delete, "PATCH": patch}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -1,22 +1,28 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete",
|
||||
"patch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete",
|
||||
"patch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user