Some fixes based on PR comments.

This commit is contained in:
mike12345567 2022-10-24 12:06:50 +01:00
parent fbed8923dc
commit 5340b49d6b
3 changed files with 11 additions and 16 deletions

View File

@ -4,7 +4,7 @@ import { JobQueue } from "./constants"
import InMemoryQueue from "./inMemoryQueue"
import BullQueue from "bull"
import { addListeners, StalledFn } from "./listeners"
const { opts, redisProtocolUrl } = getRedisOptions()
const { opts: redisOpts, redisProtocolUrl } = getRedisOptions()
const CLEANUP_PERIOD_MS = 60 * 1000
let QUEUES: BullQueue.Queue[] | InMemoryQueue[] = []
@ -18,9 +18,9 @@ async function cleanup() {
export function createQueue<T>(
jobQueue: JobQueue,
opts: { removeStalledCb?: StalledFn }
opts: { removeStalledCb?: StalledFn } = {}
): BullQueue.Queue<T> {
const queueConfig: any = redisProtocolUrl || { redis: opts }
const queueConfig: any = redisProtocolUrl || { redis: redisOpts }
let queue: any
if (!env.isTest()) {
queue = new BullQueue(jobQueue, queueConfig)

View File

@ -1,4 +1,3 @@
export * from "./documents"
export * from "./sdk"
export * from "./api"
export * from "./core"

View File

@ -1,4 +1,4 @@
import { Context } from "koa"
import { Context, Request } from "koa"
import { User } from "../documents"
import { License } from "../sdk"
@ -7,15 +7,11 @@ export interface ContextUser extends User {
license: License
}
export interface BBContext {
user?: ContextUser
status?: number
request: {
body: any
}
params: any
body?: any
redirect?: any
attachment: any
throw: any
export interface BBRequest extends Request {
body: any
}
export interface BBContext extends Context {
request: BBRequest
user?: ContextUser
}