1
0
Fork 0
mirror of synced 2024-06-28 19:10:33 +12:00

Some fixes based on PR comments.

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

View file

@ -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)

View file

@ -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"

View file

@ -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 body: any
status?: number }
request: {
body: any export interface BBContext extends Context {
} request: BBRequest
params: any user?: ContextUser
body?: any
redirect?: any
attachment: any
throw: any
} }