Edit job interval after initialization #179
Answered
by
shadowgate15
federicoodorizzi
asked this question in
Q&A
-
Hey, is there a way to change the interval of a job while it is running? I was thinking of sending the new interval value using an API request, and then update the job accordingly. Is that possibile? Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
shadowgate15
Jun 5, 2022
Replies: 2 comments
-
You would need to something like below: // stop job
bree.stop(NAME);
// find the job in config array
const idx = bree.config.jobs.findIndex(j => j.name === NAME);
// set with new interval
bree.config.jobs[idx] = { ...bree.config.jobs[idx], interval: NEW_INTERVAL };
// restart job
bree.start(NAME); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
federicoodorizzi
-
Has anyone successfully got this to work? I tried today and kept getting in to situations where Bree just wouldn't run the job at all after changing the interval using the above code. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You would need to something like below: