Some fixes based on PR comments.
This commit is contained in:
parent
fbed8923dc
commit
5340b49d6b
|
@ -4,7 +4,7 @@ import { JobQueue } from "./constants"
|
||||||
import InMemoryQueue from "./inMemoryQueue"
|
import InMemoryQueue from "./inMemoryQueue"
|
||||||
import BullQueue from "bull"
|
import BullQueue from "bull"
|
||||||
import { addListeners, StalledFn } from "./listeners"
|
import { addListeners, StalledFn } from "./listeners"
|
||||||
const { opts, redisProtocolUrl } = getRedisOptions()
|
const { opts: redisOpts, redisProtocolUrl } = getRedisOptions()
|
||||||
|
|
||||||
const CLEANUP_PERIOD_MS = 60 * 1000
|
const CLEANUP_PERIOD_MS = 60 * 1000
|
||||||
let QUEUES: BullQueue.Queue[] | InMemoryQueue[] = []
|
let QUEUES: BullQueue.Queue[] | InMemoryQueue[] = []
|
||||||
|
@ -18,9 +18,9 @@ async function cleanup() {
|
||||||
|
|
||||||
export function createQueue<T>(
|
export function createQueue<T>(
|
||||||
jobQueue: JobQueue,
|
jobQueue: JobQueue,
|
||||||
opts: { removeStalledCb?: StalledFn }
|
opts: { removeStalledCb?: StalledFn } = {}
|
||||||
): BullQueue.Queue<T> {
|
): BullQueue.Queue<T> {
|
||||||
const queueConfig: any = redisProtocolUrl || { redis: opts }
|
const queueConfig: any = redisProtocolUrl || { redis: redisOpts }
|
||||||
let queue: any
|
let queue: any
|
||||||
if (!env.isTest()) {
|
if (!env.isTest()) {
|
||||||
queue = new BullQueue(jobQueue, queueConfig)
|
queue = new BullQueue(jobQueue, queueConfig)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
export * from "./documents"
|
export * from "./documents"
|
||||||
export * from "./sdk"
|
export * from "./sdk"
|
||||||
export * from "./api"
|
export * from "./api"
|
||||||
export * from "./core"
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Context } from "koa"
|
import { Context, Request } from "koa"
|
||||||
import { User } from "../documents"
|
import { User } from "../documents"
|
||||||
import { License } from "../sdk"
|
import { License } from "../sdk"
|
||||||
|
|
||||||
|
@ -7,15 +7,11 @@ export interface ContextUser extends User {
|
||||||
license: License
|
license: License
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BBContext {
|
export interface BBRequest extends Request {
|
||||||
user?: ContextUser
|
|
||||||
status?: number
|
|
||||||
request: {
|
|
||||||
body: any
|
body: any
|
||||||
}
|
}
|
||||||
params: any
|
|
||||||
body?: any
|
export interface BBContext extends Context {
|
||||||
redirect?: any
|
request: BBRequest
|
||||||
attachment: any
|
user?: ContextUser
|
||||||
throw: any
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue