goreman icon indicating copy to clipboard operation
goreman copied to clipboard

add starting delay when proc start

Open seiferli opened this issue 2 years ago • 4 comments

sleep N sec AT startProcs() . because sometimes, dependencies checking between stateful services (procs) will let it starting fail .

seiferli avatar Mar 16 '23 02:03 seiferli

Thank you. Could you please explain this use-case?

mattn avatar Mar 16 '23 02:03 mattn

For example:

I have three services in the Procfile, A, B, and C Service B must detect that Service A is successful, and the listen port must be started when B starting, If there is no enought runing interval, the startup of Service B will fail, this is my real use-case. :)

The same situation also occurs when procStop(). In stateful services, the order of startup and shutdown is often the opposite.

seiferli avatar Mar 17 '23 03:03 seiferli

Do not modify color table.

mattn avatar Mar 17 '23 03:03 mattn

hey

i think delay is a good idea and should go in.

The other way to do this is to us the "wait-for" pattern that waits on a tcp ip based process. Its basically doing what docker does with "depends on" syntax in docker.

https://github.com/roerohan/wait-for-it

  • waits on tcp / http
  • has delay feature also.

dep:
     # https://github.com/roerohan/wait-for-it
     go install github.com/roerohan/wait-for-it@latest
test-0:
     wait-for-it google.com:80 -- echo "It works\!"
test-1:
     wait-for-it -w google.com:80 -w localhost:27017 -t 30 -- echo "Waiting for 30 seconds for google.com:80 and localhost:27017"

https://github.com/atkrad/wait4x is another one

  • has delay
  • has backoff / time out / rety.

joeblew99 avatar Aug 22 '23 10:08 joeblew99