1

suppose I am running a worker dyno with following python code in heroku

import time
time.sleep(60*60)
exit()

I want to stop the worker completely, this code ends the program, but it starts again having the same effect as heroku ps:restart worker what should I write in the code to have the same effect as heroku ps:scale worker=0, is this possible ? If not what are my alternatives ?

Puck
  • 2,080
  • 4
  • 19
  • 30
Nikhil Singh
  • 353
  • 1
  • 17

1 Answers1

2

The worker processes defined in your Procfile should be always-on workers, same as the web-processes you define in there.

For one-off tasks that exit afterwards you can use a one-off worker dyno. You can also easily define them in the Heroku scheduler.

Denis Cornehl
  • 4,104
  • 1
  • 20
  • 24