Rare one off jobs & dynamic scheduled jobs
See original GitHub issueI was really excited to see this library pop up - it’s awesome to see something using native worker threads and not requiring redis/mongo/some other store. But was then a bit confused by the configuration method when it came to trying it out.
I have use cases for different types of jobs:
- recurring jobs that operate like a cron
- one off, super rare, but long-running tasks that might never be run in the lifetime of the process
- jobs that are generated dynamically and need to be run at a specific time
- 1 seems to be the main use case for Bree, but in my case the use case is smallest
- 2 is the my main use case - I can sort of see how I might manage it by not calling bree.start() and only calling bree.run(‘task’) if the long running task is needed, but that feels like I’m not using the tool properly
- 3 is a nice to have - already have code doing this, but unless I’m missing something there’s no way to achieve it with Bree - except approximation with a cron running every minute to check
Given the rareness of the one-off jobs, it’s a shame to have to declare them upfront, rather than being able to add them if and when they show up - otherwise there’s overhead for no good reason.
With type 3 specifically, I find it odd that Bree has support for setting an exact date when a job should run, but that can only be set on instantiation?
I guess I’m looking for bree.add(({jobConfig})
or bree.run({jobConfig})
- or am I massively missing something?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:41 (25 by maintainers)
Top Results From Across the Web
How to add new schedule job dynamically with Spring
If you want to dynamically schedule tasks you can do it without spring by using ExecutorService in particular ScheduledThreadPoolExecutor
Read more >Dynamic Scheduling of Parallel Jobs with QoS Demands in ...
This paper addresses the dynamic scheduling of paral- lel jobs with QoS demands (soft-deadlines) in multi- clusters and grids. Three metrics (over-deadline,.
Read more >Scheduled Task/Job, Technique T1053 - MITRE ATT&CK®
Monitor newly constructed scheduled jobs that may abuse task scheduling functionality to facilitate initial or recurring execution of malicious ...
Read more >Building a simple dynamic job scheduler with Sidekiq - Tines
Every minute, we run a Sidekiq job (enqueued by sidekiq-scheduler) that acts as a “fan out” job. It queries the database for any...
Read more >Jobs | Kubernetes
A Job creates one or more Pods and will continue to retry execution of the ... at the same time offloading actual pod-to-node...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
v3.0.0 of Bree is released with support for Node v10+ and browsers.
See the updated README at https://github.com/breejs/bree#readme.
https://github.com/breejs/bree/releases/tag/v3.0.0
@shadowgate15 i tried this in the dummy function i sent you and it worked, although i dont understand the difference from what i wrote, since im using the await keyword for thw asyn operation and all the other operations are synchronous.
Now applying this approach to my real job doesnt work, it fails just as before. My real job:
(async () => { console.log(“In worker”);
//nothing executes after the previous await console.log(“push tokens”, pushTokens);
process.exit(0); })();
As you said with the dummy, i tried wrapping everything apart from the process.exit(0) in an async function, awaiting and the doing process.exit() but it didn’t work, this is confusing