#When adding job to queue the control stops there and the api call times out (using @nestjs/bull)

5 messages · Page 1 of 1 (latest)

little prairie
#

I am running the bull in a kube container when the .add function executes, the API stops executing and eventually times out(works fine on the local environment with the same Redis cluster(via ssh) used in the pod). Will add implementation in comment.

#

`import { BullModule } from '@nestjs/bull'
import { Global, Module, Provider } from '@nestjs/common'
import { QueueService } from './queue.service'
import { USER_SIGN_IN_QUEUE, UserSignInProcessor } from './processors/user-sign-in.processor'
import { BullConfigService } from './bull.config.service'
import { REDIS_CONFIG, RedisConfigType } from 'lib/config/redis.config'
import { getConfig } from 'lib/config'

@Global()
@Module({
imports: [
BullModule.forRootAsync({
useClass: BullConfigService
}),
BullModule.registerQueue({
name: USER_SIGN_UP_QUEUE, redis: {
host: getConfig().redis.host,
port: getConfig().redis.port,
keyPrefix: getConfig().redis.redisChannelPrefix
}
}
})
],
providers: [UserSignInProcessor, QueueService],
exports: [BullModule, QueueService]
})
export class QueueModule { }
`

queue module

#

`import { InjectQueue } from '@nestjs/bull'
import { Injectable } from '@nestjs/common'
import { Queue } from 'bull'
import { USER_SIGN_IN_QUEUE, USER_SIGNIN_EVENT } from './processors/user-sign-in.processor'

@Injectable()
export class QueueService {
constructor(
@InjectQueue(USER_SIGN_IN_QUEUE) private userSigninQueue: Queue
) { }

async signInUserQueue(data: any) {
    try {
        console.log('start')
        await this.userSigninQueue.add(USER_SIGNIN_EVENT, data)
        console.log('end')
    } catch (error) {
        console.log(error)
    }
}

}
`
queue service
here the server has a start log but not end and error as well

#

`import { BullModuleOptions, SharedBullConfigurationFactory } from "@nestjs/bull"
import { Injectable } from "@nestjs/common"
import { getConfig } from "lib/config"

@Injectable()
export class BullConfigService implements SharedBullConfigurationFactory {
constructor() { }
createSharedConfiguration(): BullModuleOptions {
return {
redis: {
host: getConfig().redis.host,
port: getConfig().redis.port
},
prefix: getConfig().redis.redisChannelPrefix
}
}
}`

#

When add job to queue the control stops there and the api call times out (using @nestjs/bull)