Comments (6)
Currently, the way I am handling this is with cluster.isMaster();
basically:
if(cluster.isMaster()) {
require('./lib/jobs');
}
I agree that ultimately we want to make sure that multiple nodes can process from the same database. This is a temporary workaround until we figure out something better.
Any ideas on how we should implement this @sansmischevia ?
from agenda.
Hi!
I think this can be done through the lockedAt db field, findAndModify method and agent.define's lockLifetime argument or job.setLockLifetime method. What do you think about it?
from agenda.
I agree for the most part - specifically find and modify.
I don't know if we need lockedAt
vs just a boolean locked
. I suppose the advantage is if we crash we can have a timeout so we don't corrupt the database.
I think, then, that perhaps defining the lock timeout on the agenda instead of per job would be better. Otherwise we would have to query for a bunch of different locked times, which woulds result in n
queries to the database, where n
is the number of different lockLifetimes
on the job. By doing it per agenda
we can do it in 1 query.
from agenda.
Ok. I will try to implement it via agenta.define('job name', {lockLifetime: 1000/*ms*/ }, cb)
, lockedAt
db field and findAndModify
method.
from agenda.
Implemented in 0.5.0
from agenda.
Awesome, thanks @bars3s and @rschmukler! Now to re-write a ton of code with this new addition... agenda had a showstopper due to multi-server issues, but now it's a real lib that rivals quartznet.sourceforge.net
from agenda.
Related Issues (20)
- Jobs not running in production HOT 6
- lockLifetime not updatable when job is running HOT 1
- Some feature not work in version 6.X?
- TypeError: Cannot read properties of undefined (reading 'collection') HOT 4
- MongoDB connections are getting increased gradually
- Is npm agenda deprecated? Am I supposed to start using @hokify/agenda? HOT 3
- Agenda repeatEvery('10 seconds') fails processing remaining jobs
- Longer schedule time (more than one hour from current date or next hour) not triggering
- TimeoutOverflowWarning: 2428508862 does not fit into a 32-bit signed integer.
- Agenda sometimes dont restart the job execution
- Canceling jobs HOT 2
- It seems agenda doesn't connect with mongoose 7.x. Any plans to make it compatible with newer versions of mongoose? HOT 1
- Is there a way to update a job's original payload?
- Questions: REST API - safe to instantiate a new Agenda at each received request? Every can handle only a single job at a time? HOT 1
- With pm2 lots of connections are always open HOT 1
- "mongoose": "^8.0.4" and "agenda": "^5.0.0", getting error HOT 2
- RIP HOT 9
- Scheduled job runs multiple times HOT 2
- Unable to build typescript project with Agenda HOT 2
- Agenda 5.0.0 not compatible with Mongoose 8.2.1 HOT 2
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 agenda.