This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
Replies: 2 comments 1 reply
-
For each request it will spawn a new instance of a micro and each instance will have a 10 sec timeout duration. |
Beta Was this translation helpful? Give feedback.
1 reply
-
micros get their processes terminated (and therefor the bg tasks) the moment they return anything. i believe this only affects python micros though. the event loop in nodejs might help node micro not terminate on return. @aavshr can correct me here. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a published under "Important Notes" :
Features like [Background Tasks](https://www.starlette.io/background/) and [Startup/Shutdown Events](https://www.starlette.io/events/) will currently not work as expected on Micros.
I have tested with a background task and it seems to work pretty well. I have an endpoint that receives the request and immediately returns a 200 that the task is being processed as a background task. A function (async def) is called to execute the task based on the input provided.
Is the above due, solely, to the 10s execution time out? In my case, would the 10s be from the time the endpoint is invoke to the time the task is completed? And that each call at the endpoint would trigger is separate 10s timeout? If so, does it mean that I have simple task that using background task in Deta would not be a problem. So for example an fastapi-mail allows for 10 emails to be added addressees that that might take more than 10s but a single email in the list (for gmail) executes instanteously.
What I did notice, is that any print does not show up on the visor log. I can understand why this would be the case but is there a way to write to the visor log? I am writing to a Base now and this working quite well for me.
TIA
Beta Was this translation helpful? Give feedback.
All reactions