-
-
Notifications
You must be signed in to change notification settings - Fork 90
feat: add early shutdown when no requests received for X milliseconds #582
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
Conversation
56dc063
to
2202845
Compare
Does this have any effect if requestAbsentTimeoutMs is not set? @nyannyacha ![]() |
@farzd Are you using Background tasks to run the function? If so, it wouldn't shutdown early. https://supabase.com/docs/guides/functions/background-tasks Also from the log events, I cannot see a shutdown event. When a function is shutdown there would be a shutdown log event which shows the reason for shutdown. The early shutdowns will show as "EarlyDrop" as the reason. |
Thanks for the reply @laktek . I'm not using background Tasks. (also please note, i only started having these issues as of recent, wasn't getting early drops before) ![]()
|
Pro plan gives you 400s, but if the worker (isolate) becomes idle it'll shutdown. The way we detect if the isolate is idle is by checking if it has pending requests or active background tasks. So if you update your code to run the long-running task as a background task it'll ensure to run for 400s.
We always had this behavior, but recently, we refactored the code so it's applied based on the load in each region. This ensures all users get a fair amount of resources, which is probably why you started having these issues recently. For further support, I'd recommend opening a support ticket. |
Thanks @laktek |
What kind of change does this PR introduce?
Feature
Description
This PR makes it possible to terminate a worker early if no subsequent response exists for more than X milliseconds from the last request.
You can specify this option when creating the user worker, as shown in the following snippet, and it must be specified in milliseconds: