Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
simllll committed Oct 13, 2020
1 parent 5f74603 commit 57ac2db
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Typescript rewrite of agendaJS
<p align="center">
<img src="https://cdn.jsdelivr.net/gh/agenda/agenda@master/agenda.svg" alt="Agenda" width="100" height="100">
</p>
Expand All @@ -15,6 +16,15 @@
<br>
</p>

# Fork
This is a fork of agenda js, it differs from the original version in following points:
- Complete rewrite in Typescript (fully typed!)
- Supports mongoDB sharding by name
- touch() can have an optional progress parameter (0-100)
- Bugfixes and improvements for locking
- Breaking change: define() config paramter moved from 2nd position to 3rd
- getRunningStats()

# Agenda offers

- Minimal overhead. Agenda aims to keep its code base small.
Expand Down Expand Up @@ -93,15 +103,15 @@ agenda.define('delete old users', async job => {
```

```js
agenda.define('send email report', {priority: 'high', concurrency: 10}, async job => {
agenda.define('send email report', async job => {
const {to} = job.attrs.data;
await emailClient.send({
to,
from: 'example@example.com',
subject: 'Email Report',
body: '...'
});
});
}, {priority: 'high', concurrency: 10}, );

(async function() {
await agenda.start();
Expand Down Expand Up @@ -337,7 +347,7 @@ await agenda.start();

Before you can use a job, you must define its processing behavior.

### define(jobName, [options], fn)
### define(jobName, fn, [options])

Defines a job with the name of `jobName`. When a job of `jobName` gets run, it
will be passed to `fn(job, done)`. To maintain asynchronous behavior, you may
Expand Down Expand Up @@ -556,9 +566,9 @@ You can configure the locking mechanism by specifying `lockLifetime` as an
interval when defining the job.

```js
agenda.define('someJob', {lockLifetime: 10000}, (job, cb) => {
agenda.define('someJob', (job, cb) => {
// Do something in 10 seconds or less...
});
}, {lockLifetime: 10000});
```

This will ensure that no other job processor (this one included) attempts to run the job again
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"repository": {
"type": "git",
"url": "git://github.com/agenda/agenda"
"url": "git://github.com/@hokify/agenda"
},
"keywords": [
"job",
Expand All @@ -45,7 +45,7 @@
"author": "Ryan Schmukler <ryan@slingingcode.com> (http://slingingcode.com/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/agenda/agenda/issues"
"url": "https://github.com/@hokify/agenda/issues"
},
"dependencies": {
"cron": "~1.8.2",
Expand Down

0 comments on commit 57ac2db

Please sign in to comment.