diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-03-18 11:17:05 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-18 11:17:05 +0900 |
| commit | 4f249159d310d4296753fcfe8e2bbd390fd9002b (patch) | |
| tree | 9b483af801a15048265531bcba811c5eb185fb2d /src/queue/initialize.ts | |
| parent | add note (diff) | |
| download | sharkey-4f249159d310d4296753fcfe8e2bbd390fd9002b.tar.gz sharkey-4f249159d310d4296753fcfe8e2bbd390fd9002b.tar.bz2 sharkey-4f249159d310d4296753fcfe8e2bbd390fd9002b.zip | |
Improve chart performance (#7360)
* wip
* wip
* wip
* wip
* wip
* Update chart.ts
* wip
* Improve server performance
* wip
* wip
Diffstat (limited to 'src/queue/initialize.ts')
| -rw-r--r-- | src/queue/initialize.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/queue/initialize.ts b/src/queue/initialize.ts new file mode 100644 index 0000000000..92579531e4 --- /dev/null +++ b/src/queue/initialize.ts @@ -0,0 +1,18 @@ +import * as Queue from 'bull'; +import config from '../config'; + +export function initialize(name: string, limitPerSec = -1) { + return new Queue(name, { + redis: { + port: config.redis.port, + host: config.redis.host, + password: config.redis.pass, + db: config.redis.db || 0, + }, + prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : 'queue', + limiter: limitPerSec > 0 ? { + max: limitPerSec * 5, + duration: 5000 + } : undefined + }); +} |