Node.js setInterval and CRON tasks scheduler and manager for horizontally scaled multi-server applications
BSD-3-CLAUSE License
Bot releases are visible (Hide)
📦 NPM @5.0.0
☄️ Packosphere @5.0.0
What's New
async
/await
API for all public methodsready()
Major Changes
opts.adapter
now expects instance of the StorageAdapter, was: Class of StorageAdapter
opts.prefix
and opts.resetOnInit
to StorageAdapter's constructoropts.client
, opts.db
, and lockCollectionName
to StorageAdapter's constructorChanges
new RedisAdapter({})
new MongoAdapter({})
v4 to v5 migration
Although setInterval
and setTimeout
now return {Promise} instead of {String} updated clearInterval
and clearTimeout
methods accept {Promise}, so migration might not be necessary. Next block of code will remain operational in v3
/v4
and v5
:
const taskId = job.setInterval((ready) => {
/* code here */
ready();
}, 2048, 'task-2048ms');
job.clearInterval(taskId);
Migration is necessary only if callbacks of clearInterval
and clearTimeout
were used. Callbacks need to get replaced by await
. setInterval
and setTimeout
will require using await
to obtain timerId
.
was in v3/v4:
const taskId = job.setInterval((ready) => {
/* code here */
ready();
}, 2048, 'task-2048ms');
job.clearInterval(taskId, () => {
// task cleared now
});
change to for v5:
const taskId = await job.setInterval((ready) => {
/* code here */
ready();
}, 2048, 'task-2048ms');
await job.clearInterval(taskId);
// task cleared now
Now it's possible to return promises, previously ready()
was required to call in v3/v4:
job.setInterval((ready) => {
/* code here */
ready();
}, 2048, 'task-2048ms');
now simply register async
function in v5:
job.setInterval(async () => {
/* code here */
}, 2048, 'task-2048ms');
or simply return promise in v5:
job.setInterval(() => {
/* code here */
return promisedValue; // instance of the Promise
}, 2048, 'task-2048ms');
or async
/await
the promise in v5:
job.setInterval(async () => {
/* code here */
return await promisedValue;
}, 2048, 'task-2048ms');
now calling ready()
inside async
function will not work in v5:
job.setInterval(async (ready) => {
/* code here */
ready(); // <-- won't run, will log a debug message here
}, 2048, 'task-2048ms');
Published by dr-dimitru 7 months ago
📦 NPM @4.0.0
☄️ Packosphere @4.0.0
Major Changes:
import
and require
the package import { JoSk, RedisAdapter, MongoAdapter } from 'josk';
new JoSk({})
Changes:
opts.adapter
{RedisAdapter|MongoAdapter}opts.client
{RedisClient}Dev Dependencies:
[email protected]
, was v4.4.1
[email protected]
, was v10.3.0
[email protected]
Published by dr-dimitru 7 months ago
📦 NPM @3.1.1
☄️ Packosphere @3.1.1
Major Changes:
Changes:
Dev Dependencies:
[email protected]
, was v6.3.0
pathval
, was v2.0.0
Published by dr-dimitru 7 months ago
📦 NPM @3.1.0
☄️ Meteor.js @3.1.0
Major Changes:
@>=14.20.0
, was @>=8.9.0
Changes:
mongod
server, tested with @4.4.29
, @5.0.25
, @6.0.14
, and @7.0.6
mongodb
driver for node.js, tested with @4.17.2
, @5.9.2
, and @6.5.0
nodejs
releases, tested with @14.21.3
, @18.19.1
, @20.11.1
, and @21.7.1
[email protected]
and its packagesDev Dependencies:
[email protected]
, was v4.6.1
[email protected]
, was v4.0.2
[email protected]
, was v4.3.6
[email protected]
, was v4.5.0
[email protected]
, was v10.0.0
[email protected]
, was v4.7.0
[email protected]
, was v1.1.1
Published by dr-dimitru over 2 years ago
[email protected]
.meteorignore
Published by dr-dimitru over 2 years ago
[email protected]
Dependencies:
Development packages used for testing
[dev]
[email protected]
, was v4.6.3
[dev]
[email protected]
, was v4.6.0
Published by dr-dimitru over 2 years ago
📦 v3.0.0
Now ☄️ meteor
and 📦 NPM
follow the same versioning pattern. In this release we have added couple of new features and improved existing codebase.
New features:
opts.lockCollectionName
— new JoSk()
constructor optionopts.debug
— new JoSk()
constructor optionready()
— Function passed as an argument to a scheduled task now accepts a callback, see CRON usage example
JoSk#clearTimeout()
and JoSk#clearInterval()
— Methods now accept callback as a last argumentMajor changes:
*.lock
collection, this behavior can get changed using opts.lockCollectionName
constructor optionOther changes:
[email protected]
(Mongo Database)[email protected]
(MongoDB node.js driver)[email protected]
Dependencies:
[dev]
[email protected]
, was v4.5.0
[dev]
added [email protected]
for CRON tasks testsPublished by dr-dimitru over 2 years ago
👷♂️ This is maintenance release:
[email protected].*
(Node.js native driver)mongod@4.*
and mongod@5.*
(MongoDB server)[email protected].*
Updated dev
dependencies:
[dev]
[email protected]
, was v4.2.2
[dev]
[email protected]
, was v2.0.5
[dev]
[email protected]
, was v4.3.0
[dev]
[email protected]
, was v8.2.1
[dev]
[email protected]
, was v3.6.4
Published by dr-dimitru over 3 years ago
Critical Changes:
opts.minRevolvingDelay
by default 128
ms, was 32;opts.maxRevolvingDelay
by default 768
ms, was 256;{ writeConcern }
options removed from write/update operations, pass recommended readConcern
, writeConcern
, and readPreference
as mongodb connections settings;.lock
prefix;new JoSk({ prefix })
to a database it's connected.Changes:
[email protected]
(node native driver);meteor@2.*
;Published by dr-dimitru about 4 years ago
v2.5.0
v2.3.0
[email protected]
;.destroy()
— Stop all timers. After JoSk
instance is destroyedclearTimeout
andclearInterval
);[dev]
[email protected]
, was v4.0.4
;[dev]
[email protected]
, was v2.0.3
;[dev]
[email protected]
, was v7.1.2
;[dev]
[email protected]
, was v3.5.7
.Published by dr-dimitru over 4 years ago
v2.4.4
v2.2.5
Changes:
[email protected]
(mongo-native);[email protected]
;[email protected]
(was [email protected]
);[email protected]
(was [email protected]
).Published by dr-dimitru over 4 years ago
v2.4.3
v2.2.4
Changes:
[email protected]
(mongo-native);[email protected].*
;[email protected]
(was [email protected]
);[email protected]
(was [email protected]
);[email protected]
(was [email protected]
);Published by dr-dimitru over 4 years ago
v2.4.2
v2.2.3
Changes:
[email protected].*
;Published by dr-dimitru almost 5 years ago
v2.4.1
v2.2.2
(v2.2.1
got broken upon publishing to NPM)Changes:
.npmignore
onError
hook is used in every possible scenario where exception can be thrown[email protected]
(server database executable)[email protected]
[email protected]
; (was [email protected]
)Published by dr-dimitru about 5 years ago
v2.4.0
v2.2.0
New:
delay
— now passed as a part of the "details" Object in onExecuted
hookmaxRevolvingDelay
— the minimum delay between tasks executions in millisecondsminRevolvingDelay
— the maximum delay between tasks executions in millisecondsChanges:
.npmignore
Published by dr-dimitru about 5 years ago
v2.3.1
v2.1.1
inProgress
from MongoDB records as it isn't used anymorebson-ext
updated to v2.0.3
(was v2.0.2
)mocha
updated to v6.2.1
(was v6.0.2
)Published by dr-dimitru over 5 years ago
v2.3.0
v2.1.0
[email protected]
Published by dr-dimitru over 5 years ago
Published by dr-dimitru over 5 years ago