Comments (2)
Thanks for the quick reply.
By background do you mean in other threads? I think it should not be done by default. My current use cases are all written by sharing a RefCell without Mutex and I think the single-threaded model should stay the default because it's usually sufficient and the simplest to manage (and for backwards compatibility with code using this crate where the job closures aren't Send + 'static
)..
E.g. in my cases, it has to stay that way that only one job is running at a time and they all run sequentially..
When you introduce multi-threading, it would force all closures to be Send + 'static
, even for use cases that will be configured to run sequentially/single-threaded, requiring Arc<Mutex<SharedData>>
:/
Maybe it would make sense to introduce a second ParallelJobScheduler
which requires the closures to be Send + 'static
but the normal one doesn't have to impose those constraints on the closures..
The debouncing wouldn't be necessary for multi-threading because jobs never have to be delayed by other jobs (but it could be configurable if they should be re-entrant or run sequentially with other instances of the same job).
And the need to run at most 1 job per tick()
call also doesn't apply to the multi-threaded version because there wouldn't have to be a tick()
call to advance the jobs..
So I think the multi-threading version of the JobScheduler
should be thought about separately from the needs / config options that only apply to the single threaded version.
E.g. I would add the config options for "run at most 1 job per tick()
call" and "run at most 1 instance of a delayed job, before starting the waiting period again" to the single-threaded JobScheduler
first, and then afterwards think about designing a multi-threaded version :)
from job_scheduler.
Funny, I have use cases that have the inverse requirement. Occasionally a job will get backed up and I want the system to catch up.
It seems entirely reasonable and expected to be able to debounce requests though.
An interesting quirk in regards to debouncing though.. another user requested that jobs be able to run in the background. Backgrounded + debounce would require synchronizing the status and such.
Seems like when starting up the scheduler you should be able to configure features such as backgrounding and debouncing.
I'll take a look at implementing this in the near future. Likely this weekend or maybe while at RustConf.
from job_scheduler.
Related Issues (20)
- Working around `tick` HOT 4
- Is time absolute or relative to scheduler start? / When will a job run the first time? HOT 1
- Documentation is down HOT 3
- Date change can lead to high CPU usage, program crashes, and system instability.
- Add timezone configuration HOT 1
- Update Crates.io HOT 3
- Please update cron HOT 3
- `dyn std::ops::FnMut()` cannot be sent between threads safely
- Actix web support HOT 1
- Update cron to version 0.7
- Is this project still maintained? HOT 2
- #notanissue Tokio async version
- How to use async function in run thread? HOT 1
- Day of Week, expression "1-5" results in execution on Sunday? HOT 1
- Meet a issue when I add the notification handler to Job HOT 1
- Ability to remove job from schedule HOT 11
- Are there plans for reentrancy protection? HOT 2
- * 0/2 * * * * * every two minutes seems to run every second HOT 1
- Not working with latest nightly (as of at least 2018-05-30) HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from job_scheduler.