Skip to content

Commit ba85d2f

Browse files
committed
docs: improve readme
Signed-off-by: Ute Weiß <ute.weiss@tngtech.com>
1 parent 9641ccd commit ba85d2f

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,16 @@ await mongoSchedule.disconnect();
102102

103103
You can instantiate a momo job using the `MomoJobBuilder` class. It provides the following setter methods:
104104

105-
| setter | parameter | mandatory | default value | description |
106-
|------------------|--------------------------------------------------------------------------------|-----------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
107-
| withName | `name: string` | yes | | The name of the job. Used as a unique identifier. |
108-
| withSchedule | `interval: number \| string`, `firstRunAfter: number \| string` (default: `0`) | no | | Either this setter or `withCronSchedule()` must be called. Specifies the schedule for starting the job. Time intervals can be given in human-readable formats (like '1 minute', 'ten days', 'twenty-one days and 2 hours' or 'never') or in milliseconds. Check the documentation of [ human-interval ](https://www.npmjs.com/package/human-interval) for details. A job with interval 'never' will not be started to run periodically but needs to be run explicitly. If the job never ran before, the job will run after `firstRunAfter` for the first time. Just like the `interval`, `firstRunAfter` can also be given in a human-readable format or as milliseconds. The maximum value for both `interval` and `firstRunAfter` is 2147483647 ms (or its human readable equivalents). |
109-
| withCronSchedule | `cronSchedule: string` | no | | Either this setter or `withCronSchedule()` must be called. Specifies the cron schedule according to which the job will run. See https://www.npmjs.com/package/cron#cron-ranges for the allowed cron ranges. |
110-
| withConcurrency | `concurrency: number` | no | 1 | How many instances of a job are started at a time. |
111-
| withMaxRunning | `maxRunning: number` | no | 0 | Maximum number of job executions that is allowed at a time. Set to 0 for no max. The schedule will trigger no more job executions if maxRunning is reached. |
112-
| withHandler | `handler: function` | yes | | The function to execute. |
113-
| withTimeout | `timeout: number` | no | | The timeout for the executed function. If a mongo error occurs during job execution and timeout is defined, the job will be stopped and automatically restarted after `timeout` ms to recover from the error. If no timeout is specified, momo might end up in an error state (not executing the affected job correctly anymore) that requires a manual restart. |
114-
| withParameters | `jobParameters: JobParameters` | no | | The parameters the `handler` function is called with. |
105+
| setter | parameter | mandatory | default value | description |
106+
|------------------|--------------------------------------------------------------------------------|-----------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
107+
| withName | `name: string` | yes | | The name of the job. Used as a unique identifier. |
108+
| withSchedule | `interval: number \| string`, `firstRunAfter: number \| string` (default: `0`) | no | | Either this setter or `withCronSchedule()` must be called. Specifies the schedule for starting the job. Time intervals can be given in human-readable formats (like '1 minute', 'ten days', 'twenty-one days and 2 hours' or 'never') or in milliseconds. Check the documentation of [ human-interval ](https://www.npmjs.com/package/human-interval) for details. A job with interval 'never' will not be started to run periodically but needs to be run explicitly. If the DB holds no record of a job with the same name running before, the job will run after `firstRunAfter` for the first time. Just like the `interval`, `firstRunAfter` can also be given in a human-readable format or as milliseconds. The maximum value for both `interval` and `firstRunAfter` is 2147483647 ms (or its human readable equivalents). On jobs with interval 'never', any value passed for `firstRunAfter` is ignored. |
109+
| withCronSchedule | `cronSchedule: string` | no | | Either this setter or `withCronSchedule()` must be called. Specifies the cron schedule according to which the job will run. See https://www.npmjs.com/package/cron#cron-ranges for the allowed cron ranges. |
110+
| withConcurrency | `concurrency: number` | no | 1 | How many instances of a job are started at a time. |
111+
| withMaxRunning | `maxRunning: number` | no | 0 | Maximum number of job executions that is allowed at a time. Set to 0 for no max. The schedule will trigger no more job executions if maxRunning is reached. |
112+
| withHandler | `handler: function` | yes | | The function to execute. |
113+
| withTimeout | `timeout: number` | no | | The timeout for the executed function. If a mongo error occurs during job execution and timeout is defined, the job will be stopped and automatically restarted after `timeout` ms to recover from the error. If no timeout is specified, momo might end up in an error state (not executing the affected job correctly anymore) that requires a manual restart. |
114+
| withParameters | `jobParameters: JobParameters` | no | | The parameters the `handler` function is called with. |
115115

116116
### MongoSchedule
117117

test/scheduler/JobScheduler.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ describe('JobScheduler', () => {
5353
}
5454

5555
function createNeverJob(partialJob: Partial<JobDefinition<NeverSchedule>> = {}): JobDefinition<NeverSchedule> {
56-
const job = {
57-
name: 'interval job',
58-
schedule: { interval: 'never' } as NeverSchedule,
56+
const job: JobDefinition<NeverSchedule> = {
57+
name: 'never job',
58+
schedule: { interval: 'never' },
5959
concurrency: 1,
6060
maxRunning: 0,
6161
...partialJob,

0 commit comments

Comments
 (0)