a year ago
Hi, I am having trouble with my Django app deployed on Railway. I have a function that takes several minutes to complete, but whenever 30 seconds pass, the timeout critical error appears. Do any one knows how to increase this limit? Or any one knows if this is a memory problem?
warnings.warn(
[2024-01-23 16:37:24 +0000] [7] [CRITICAL] WORKER TIMEOUT (pid:634)
[2024-01-23 16:37:24 +0000] [634] [INFO] Worker exiting (pid: 634)
[2024-01-23 16:37:25 +0000] [7] [ERROR] Worker (pid:634) exited with code 1
[2024-01-23 16:37:25 +0000] [7] [ERROR] Worker (pid:634) exited with code 1.
[2024-01-23 16:37:25 +0000] [765] [INFO] Booting worker with pid: 765
7 Replies
a year ago
I already noticed that it is a timeout problem, and I must increase the limit in the start command. However, what is the standard solution to this problem? Because my function could take 15 minutes due to its dependency on an Excel row number. So, if the code is already optimized but the execution time is long, what is the standard solution to avoid problems with this?
a year ago
gunicorn's default timeout is 30s like you mentioned, so if you want to set the timeout to say 20 minutes set a flag on gunicorn to --timeout 1200
(on your start command)
a year ago
Thank you very much
a year ago
But realistically this kind of task should be handled with a worker queue so that the request returns instantly and the job is completed in the background
a year ago
Oh that would be a great approach. Do you have any documentation to do this? thanks in advance
a year ago
here's a template that should get you going
a year ago
thanks a lot