Skip to content

Commit

Permalink
Version 0.8.61
Browse files Browse the repository at this point in the history
- Implemented `max_jobs` feature (global maximum).
  • Loading branch information
jhuckaby committed May 22, 2021
1 parent 94ba681 commit d7fadf2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,14 @@ However, if you are trying to run Cronicle in an environment where WebSockets ar

However, please only do this if you know exactly what you are doing, and why.

### max_jobs

You can optionally set a global maximum number of concurrent jobs to allow. This is across all servers and categories, and is designed as an "emergency brake" for runaway events. The property is called `max_jobs`. The default is `0` (no limit). Example:

```js
"max_jobs": 256
```

## Storage Configuration

The `Storage` object contains settings for the Cronicle storage system. This is built on the [pixl-server-storage](https://www.npmjs.com/package/pixl-server-storage) module, which can write everything to local disk (the default), [Couchbase](http://www.couchbase.com/nosql-databases/couchbase-server) or [Amazon S3](https://aws.amazon.com/s3/).
Expand Down
5 changes: 5 additions & 0 deletions lib/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ module.exports = Class.create({
}
}

var max_jobs = self.server.config.get('max_jobs') || 0;
if (max_jobs && (job_list.length >= max_jobs)) {
return callback( new Error("Global maximum of " + max_jobs + " " + Tools.pluralize("job", max_jobs) + " already running.") );
}

if (!category.enabled) {
return callback( new Error("Category '" + category.title + "' is disabled.") );
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Cronicle",
"version": "0.8.60",
"version": "0.8.61",
"description": "A simple, distributed task scheduler and runner with a web based UI.",
"author": "Joseph Huckaby <[email protected]>",
"homepage": "https://github.com/jhuckaby/Cronicle",
Expand Down
1 change: 1 addition & 0 deletions sample_conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"scheduler_startup_grace": 10,
"universal_web_hook": "",
"track_manual_jobs": false,
"max_jobs": 0,

"server_comm_use_hostnames": false,
"web_direct_connect": false,
Expand Down

0 comments on commit d7fadf2

Please sign in to comment.