1

I am planning on having a Python app run under a free Heroku server, but I have read that there is a max 18 hour execution time before the process is slept. However, what if my app runs likes this -

  1. process something (which should take less than a second).

  2. sleep for 5 minutes.

I plan on having this script run continuously (all day long).

Does the 5 minute sleep count towards the 18 hour time limit?

1 Answer 1

2

I think it will be counted as the processing time because you are using a single thread to process a request, which is different from Heroku "sleep".

The timeout value is not configurable. If your server requires longer than 30 seconds to complete a given request, we recommend moving that work to a background task or worker to periodically ping your server to see if the processing request has been finished. This pattern frees your web processes up to do more work, and decreases overall application response times.

You can read more here : https://devcenter.heroku.com/articles/request-timeout

if you are willing to wait for 10 minutes you can try https://elements.heroku.com/addons/scheduler or use some kind of monitoring service like http://godrb.com/

1
  • Is there a way to make my app go into a "Heroku sleep", rather than the default python sleep? Also, do you mean I should run it as a background task? This has me wondering; my application will basically be in an endless loop checking for something, and if that thing is true, it will send me an email. Is Heroku the right service for this (i.e., I will never be requesting anything directly from the server).
    – stack_tom
    Dec 12, 2015 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.