cortesi / modd

A flexible developer tool that runs processes and responds to filesystem changes
MIT License
2.8k stars 128 forks source link

Is there a way to control how ofter restarts occur? #76

Open and-semakin opened 5 years ago

and-semakin commented 5 years ago

For example, I have a file that changes very often (IDE periodically saves source code to disk), but I don't want to restart a service this often, because restart is expensive. What I would prefer is to restart a deamon once in 30 seconds or even less often regardless that files are changing all the time. Is there a way to set some debounce/throttle logic?

wader commented 5 years ago

I haven't done exactly this but i've used various tricks with sleep with various success. Maybe something like this:

{
    daemon: echo build ; exec sleep 30
}

or maybe

{
        daemon: while true; do echo > dummy ; sleep 30 ; done
}

dummy {
        prep: echo build
}
pavel-kolesnikov commented 3 years ago

hopefully fixed in #101