-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task subscription api retry queue #11789
Task subscription api retry queue #11789
Conversation
✅ Deploy Preview for prefect-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! This is exactly what I was thinking! We can also look into sending a ping
and awaiting its pong
before we accept that the task has been delivered. This looks like:
pong = await websocket.ping()
await pong
If we put that after the send_json
call, we should be pretty confident that a task server got the message.
hmm
looks like starlette's |
message = await self._websocket.recv() | ||
|
||
message_data = orjson.loads(message) | ||
|
||
if message_data.get("type") == "ping": | ||
await self._websocket.send(orjson.dumps({"type": "pong"}).decode()) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh bummer, I thought we could use the built-in websocket.ping()
but that doesn't seem to be available in the server-side sockets. This works great too!
adds a retry queue for when tasks are submitted and there is no running
![image](https://private-user-images.githubusercontent.com/31014960/301251892-14106dd0-6a3a-48ff-978b-a08915d83e04.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwNjQ4MTUsIm5iZiI6MTcyMDA2NDUxNSwicGF0aCI6Ii8zMTAxNDk2MC8zMDEyNTE4OTItMTQxMDZkZDAtNmEzYS00OGZmLTk3OGItYTA4OTE1ZDgzZTA0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA0VDAzNDE1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAxMTg0YWZmZTAyMGYyNmU5NzhmNDhhN2FlOTgyZjJmNjgyZTAxMDA1Mjk2NzI3ZDFhYmFhMmQ2ZTc3NDdmZWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.dDvG86dauRddWNfoPjCPCGT0UL2838NV0kH14ZHd9_Q)
TaskServer
empirically this solves the problem I described earlier: