Skip to content

Commit

Permalink
Merge pull request #974 from mohali-id/executor_name
Browse files Browse the repository at this point in the history
The name on worker can be used as an executor name on picked job(s) as well
  • Loading branch information
inlife committed Mar 6, 2024
2 parents c09f9f1 + 44b24be commit 331b337
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/nexrender-server/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const cors = require('micro-cors')
const micro = require('micro')
const {send} = require('micro')

const withCors = cors({ allowHeaders: ['X-Requested-With','Access-Control-Allow-Origin','X-HTTP-Method-Override','Content-Type','Authorization','Accept','nexrender-secret']})
const withCors = cors({ allowHeaders: ['X-Requested-With','Access-Control-Allow-Origin','X-HTTP-Method-Override','Content-Type','Authorization','Accept','nexrender-secret','nexrender-name']})

const { router, withNamespace } = require('microrouter')
const { get, post, put, del } = require('microrouter')
Expand Down
2 changes: 1 addition & 1 deletion packages/nexrender-server/src/routes/jobs-pickup.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = async (req, res) => {
}

/* update the job locally, and send it to the worker */
send(res, 200, await update(job.uid, { state: 'picked', executor: req.headers["x-forwarded-for"] || req.socket.remoteAddress }))
send(res, 200, await update(job.uid, { state: 'picked', executor: req.headers["nexrender-name"] || req.headers["x-forwarded-for"] || req.socket.remoteAddress }))
} finally {
release();
}
Expand Down
1 change: 1 addition & 0 deletions packages/nexrender-worker/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,5 @@ Available settings (almost same as for `nexrender-core`):
* `noAnalytics` - boolean, enables or disables built-in fully-anonymous analytics, false by default
* `actions` - an object with keys corresponding to the `module` field when defining an action, value should be a function matching expected signature of an action. Used for defining actions programmatically without needing to package the action as a separate package
* `cache` - boolean or string. Set the cache folder used by HTTP assets. If `true` will use the default path of `${workpath}/http-cache`, if set to a string it will be interpreted as a filesystem path to the cache folder.
* `name` - string. An unique name (or not) to the `nexrender-worker`, and it will be identified in the `nexrender-server`. It can be used as an executor name on picked job(s) as well.

0 comments on commit 331b337

Please sign in to comment.