Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Add max processes config value
Browse files Browse the repository at this point in the history
  • Loading branch information
bufke committed Apr 28, 2022
1 parent 35e0f2d commit bb042ac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
/* eslint no-console: ["error", { allow: ["log", "error"] }] */

const cluster = require('cluster');
const config = require('./app/models/config-model');
const numCPUs = require('os').cpus().length;

const numProcesses = Math.min(config.server['max processes'], numCPUs);

if (cluster.isMaster) {
// Fork workers.
for (let i = 0; i < numCPUs; i++) {
for (let i = 0; i < numProcesses; i++) {
cluster.fork();
}

Expand Down
1 change: 1 addition & 0 deletions config/default-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"app name": "Enketo Smart Paper for KoBoCAT",
"port": "8005",
"max processes": 16,
"offline enabled": true,
"id length": 8,
"linked form and data server": {
Expand Down
4 changes: 4 additions & 0 deletions tutorials/10-configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Just used in home page `"Enketo for [your service name]"`..

The port on which your app is run, e.g. `"8005"`. Any unique assignable port will do. Generally you can leave this alone as you'll use a reverse proxy to map the public port.

#### max processes

The max number of processes Enketo will serve. Enketo will not serve more processes than the number of cpus available. Defaults to `16`.

#### offline enabled

Enable or disable offline functionality. Is either `false` or `true`.
Expand Down

0 comments on commit bb042ac

Please sign in to comment.