Aside from the formatting, something feels wrong about this. There's gotta be something different to make this a persistently running app :/ Any tips?

@brandon Would a cron job or systemd timer work or does the application have to be constantly running?

@jbauer There's two issues with that:

the first is that that's just moving where the timer is set

the second is that it means setting up some of the bootstrapping over and over again rather than just keeping node running and just re-running the same command

@brandon Hm... I don't think I know of a more elegant way to do that then. You could check the system time, watch how much time has elapsed, then call app() when 5s has passed but that's an even less elegant solution. You could also wrap the whole thing in a while loop with a sleep(5) at the end but that's also less elegant than what you currently have.

I don't think there's any other way to solve the problem of "do thing every x units of time".

Sign in to participate in the conversation

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.