1.1.0 • Published 3 years ago
users-processor v1.1.0
users-processor, a regularly scheduled processor of users.
Service to process all our users on a regular basis.
Installation
There is no published package for this package. If you need to install it for development work, please clone the repository and use yarn install.
If you need to run this service, you can do so with the docker container,
docker run -it --rm @aboutdotme/users-processor start
.
Usage
This package allows you to register tasks to be run with every user on a weekly basis.
To add a task, first create a new file in the tasks directory, then register it
with tasks.registerWeekly()
.
Modules in the tasks directory are auto-discovered for loading.
Registered tasks are passed a user object and a callback.
Here's an example:
// ./tasks/example_task.js
const tasks = require('../tasks')
function showExample (user, callback) {
console.log(`Processing ${user.user_name}...`)
// ... A real task would do things here.
callback()
}
// This registers the task.
tasks.registerWeekly(showExample)
NPM run-scripts
- start - Starts the service up.
- test - Runs mocha tests.
- watch - Runs mocha tests and watches for changes and re-runs tests.
- fixtures - Gets or loads fixtures. See live-mongodb-fixtures.
etcd configuration keys
The following keys are created for/used directly by this package.
me.users.processor.interval
- The nunmber of seconds between quering for and processing users (default:5
)
1.1.0
3 years ago