josk

Node.js setInterval and CRON tasks scheduler and manager for horizontally scaled multi-server applications

BSD-3-CLAUSE License

Downloads
3.4K
Stars
35
Committers
2

Bot releases are hidden (Show)

josk - v5.0.0 Latest Release

Published by dr-dimitru 6 months ago

📦 NPM @5.0.0
☄️ Packosphere @5.0.0

What's New

  • 🦄 async/await API for all public methods
  • 🚀 Return {Promise} from tasks instead of calling ready()

Major Changes

  • ⚠️ Drop support for callbacks
  • ⚠️ Renamed private methods for clarity
  • ⚠️ Renamed methods of "Adapter" API for clarity
  • ⚠️ opts.adapter now expects instance of the StorageAdapter, was: Class of StorageAdapter
  • ⚠️ Moved opts.prefix and opts.resetOnInit to StorageAdapter's constructor
  • ⚠️ Moved storage-related options opts.client, opts.db, and lockCollectionName to StorageAdapter's constructor

Changes

  • ✨ New options {object} accepted by new RedisAdapter({})
  • ✨ New options {object} accepted by new MongoAdapter({})
  • 👨‍🔬 Refactored tests for the new async/await API
  • 👨‍🔬 Refactored Meteor.js test-suite for the new async/await API
  • 📔 Updated documentation
  • 📔 Updated custom adapter documentation

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');
josk - v4.1.0

Published by dr-dimitru 7 months ago

📦 NPM @4.1.0
☄️ Packosphere @4.1.0

What's new

  • ✨ Added async .ping() method
josk - v4.0.0

Published by dr-dimitru 7 months ago

📦 NPM @4.0.0
☄️ Packosphere @4.0.0

Major Changes:

  • ⚠️ New way to import and require the package import { JoSk, RedisAdapter, MongoAdapter } from 'josk';
  • ⚠️ Decouple from storage, requires changes in options passed to constructor new JoSk({})
  • 🟥 Added support for Redis as adapter 🥳
  • 🍃 MongoDB as optional adapter 🥳

Changes:

  • 🟥 Added support for Redis, well tested with Redis.io and KeyDB
  • 👨‍💻 Decoupled storage from main codebase
  • ✨ Support for custom storage adapters, see custom adapter documentation
  • opts.adapter {RedisAdapter|MongoAdapter}
  • opts.client {RedisClient}
  • 👨‍🔬 Added tests for Redis
  • 👨‍🔬 Added tests for Redis within Meteor.js
  • 📔 Updated documentation
  • 📔 Created documentation for custom adapter

Dev Dependencies:

josk - v3.1.1

Published by dr-dimitru 7 months ago

📦 NPM @3.1.1
☄️ Packosphere @3.1.1

Major Changes:

  • 👨‍🔧 Fix #16 — CommonJS compatibility

Changes:

  • 🤝 Compatibility with ESM and CommonJS import/export, thanks to @masterbater for reporting the issue #16

Dev Dependencies:

  • 📦 [email protected], was v6.3.0
  • 📦 Removed rudiment dependency pathval, was v2.0.0
josk - v3.1.0

Published by dr-dimitru 7 months ago

📦 NPM @3.1.0
☄️ Meteor.js @3.1.0

Major Changes:

  • ⚠️ Minimal required version of Node.js now is @>=14.20.0, was @>=8.9.0
  • 📦 Packaged as ES Module

Changes:

  • 🤝 Compatibility with mongod server, tested with @4.4.29, @5.0.25, @6.0.14, and @7.0.6
  • 🤝 Compatibility with mongodb driver for node.js, tested with @4.17.2, @5.9.2, and @6.5.0
  • 🤝 Compatibility with the latest nodejs releases, tested with @14.21.3, @18.19.1, @20.11.1, and @21.7.1
  • 🤝 Compatibility with the latest Meteor.js and its packages
  • 🤝 Compatibility with upcoming [email protected] and its packages

Dev Dependencies:

josk - v3.0.2

Published by dr-dimitru over 2 years ago

  • 👨‍💻 Refactor locking mechanism to avoid dead-locking and minimize DB/Collection locking operations
  • 📔 Update documentation
  • 📦 Run tests with [email protected]
  • 👷‍♂️ Create .meteorignore
josk - v3.0.1

Published by dr-dimitru over 2 years ago

  • 👨‍💻 Make sure call-check-loop spins even on rare MongoDB errors
  • 🤝 Support [email protected]

Dependencies:

Development packages used for testing

josk - v3.0.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.lockCollectionNamenew JoSk() constructor option
  • opts.debugnew JoSk() constructor option
  • 👨‍💻 ready() — 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 argument

Major changes:

  • 👷‍♂️ Now all JoSk instances share the same *.lock collection, this behavior can get changed using opts.lockCollectionName constructor option

Other changes:

  • 📔 Add examples for CRON instructions usage
  • 👨‍🔬 Improve test-cases coverage to 97%
  • 👨‍💻 Overall codebase refactoring and performance improvements
  • 🤝 Compatibility and support of [email protected] (Mongo Database)
  • 🤝 Compatibility and support of [email protected] (MongoDB node.js driver)
  • 🤝 Compatibility ans support of [email protected]

Dependencies:

josk - v.2.4.1

Published by dr-dimitru over 2 years ago

  • ☄️ NPM: v2.4.1
  • 📦 Meteor: v2.6.1

👷‍♂️ This is maintenance release:

  • 🤝 Compatibility with [email protected].* (Node.js native driver)
  • 🤝 Compatibility with mongod@4.* and mongod@5.* (MongoDB server)
  • 🤝 Compatibility with [email protected].*
  • 👨‍💻 Add in-code documentation
  • 👨‍🔬 Improve test-suite covering 95% cases, closing #7
  • 📔 Improve documentation and examples

Updated dev dependencies:

josk - v2.4.0

Published by dr-dimitru over 3 years ago

  • ☄️ NPM: v2.4.0
  • 📦 Meteor: v2.6.0

Critical Changes:

  • opts.minRevolvingDelay by default 128 ms, was 32;
  • opts.maxRevolvingDelay by default 768 ms, was 256;
  • Default { writeConcern } options removed from write/update operations, pass recommended readConcern, writeConcern, and readPreference as mongodb connections settings;
  • Implement "Collection Locking" via special collection ending with .lock prefix;
  • In total this package will add two new MongoDB collections per each new JoSk({ prefix }) to a database it's connected.

Changes:

  • 🤝 Compatibility with [email protected] (node native driver);
  • 🤝 Compatibility with meteor@2.*;
  • 👨‍💻 Refactor logic and reduce read/write operations;
  • 👷 Stable distictive runs avoiding simultaneous execution across complex multi-server infrastructure;
  • 📋 Documentation update.
josk - v2.3.0

Published by dr-dimitru about 4 years ago

  • ☄️ Meteor: v2.5.0
  • 📦 NPM: v2.3.0

📋 Sum up:

  • ☄️ Compatibility with [email protected];
  • 👨‍💻 Refactor MongoDB querying logic, to avoid collisions;
  • 📋 Docs minor update;
  • 👨‍🔬 Test suite update;

✨ New Features:

  • .destroy() — Stop all timers. After JoSk instance is destroyed
    only two methods would remain available (clearTimeout and
    clearInterval);

📦 Dependencies:

josk - v2.2.5

Published by dr-dimitru over 4 years ago

  • ☄️ Meteor: v2.4.4
  • 📦 NPM: v2.2.5

Changes:

josk - v2.2.4

Published by dr-dimitru over 4 years ago

  • ☄️ Meteor: v2.4.3
  • 📦 NPM: v2.2.4

Changes:

josk - v2.2.3

Published by dr-dimitru over 4 years ago

  • ☄️ Meteor: v2.4.2
  • 📦 NPM: v2.2.3

Changes:

  • 🤝 Compatibility with [email protected].*;
  • 📦 Update dev-dependencies and test-suite;
  • 👷 This is regular maintenance release.
josk - v2.2.2

Published by dr-dimitru almost 5 years ago

  • ☄️ Meteor: v2.4.1
  • 📦 NPM: v2.2.2 (v2.2.1 got broken upon publishing to NPM)

Changes:

  • ☄️ Meteor: Reduce bundle size via updated/replaced dev-dependencies
  • 📦 NPM: Reduce package bundle size via updated .npmignore
  • 👷‍♂️ This release is focused on efficiency and performance
  • 👨‍💻 From now onError hook is used in every possible scenario where exception can be thrown
  • 🤝 Compatibility with [email protected] (server database executable)
  • 🤝 Compatibility with [email protected]
  • 👨‍🔬 Minor test-suite update
  • 📦 [dev-dependency] [email protected]; (was [email protected])
  • 📋 Minor documentation fixes
josk - v2.2.0

Published by dr-dimitru about 5 years ago

  • ☄️ Meteor: v2.4.0
  • 📦 NPM: v2.2.0

New:

  • delay — now passed as a part of the "details" Object in onExecuted hook
  • maxRevolvingDelay — the minimum delay between tasks executions in milliseconds
  • minRevolvingDelay — the maximum delay between tasks executions in milliseconds

Changes:

  • ☄️ Meteor: Reduce bundle size via updated dev-dependencies
  • 📦 NPM: Reduce package bundle size via updated .npmignore
  • 👨‍💻 Minor codebase optimization for error-prone runtime
  • 📋 Documentation update see Notes section
  • 👨‍🔬 Critical updates and dramatic enhancements in a test suite for both Meteor and NPM
josk - v2.1.1

Published by dr-dimitru about 5 years ago

  • ☄️ Meteor: v2.3.1
  • 📦 NPM: v2.1.1
  • 👷‍♂️ Better debugging logs
  • 👨‍💻 Overall codebase enhancements
  • 👨‍💻 Remove inProgress from MongoDB records as it isn't used anymore
  • 👨‍💻 Reduce amount of read/write data to/from MongoDB for TOP efficiency
  • 👨‍🔬 Test-suite (auto-tests) overall enhancements
  • 📦 Dev-dependency bson-ext updated to v2.0.3 (was v2.0.2)
  • 📦 Dev-dependency mocha updated to v6.2.1 (was v6.0.2)
josk - v2.1.0

Published by dr-dimitru over 5 years ago

  • ☄️ Meteor: v2.3.0
  • 📦 NPM: v2.1.0
  • 👨‍🔬 Merge NPM and Atmosphere packages into single repository and codebase, this should offload maintenance routine
  • 👨‍💻 Improve used MongoDB indexes
  • 👨‍💻 Minor codebase enhancements
  • 👷‍♂️ Minor auto-tests enhancements
  • 👷‍♂️ Support for [email protected]
josk - v2.0.5

Published by dr-dimitru over 5 years ago

  • 📦 Optimize package bundle size
josk - v2.0.4

Published by dr-dimitru over 5 years ago

  • Fix error Object message in the verbose MongoDB connection errors