mirror of
https://github.com/misskey-dev/misskey
synced 2024-12-23 19:19:05 +09:00
19 lines
464 B
TypeScript
19 lines
464 B
TypeScript
import * as Bull from 'bull';
|
|
import config from '@/config/index';
|
|
|
|
export function initialize<T>(name: string, limitPerSec = -1) {
|
|
return new Bull<T>(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
|
|
});
|
|
}
|