admin管理员组文章数量:1289828
I have a queue that starts a game on the backend and a function handleGameStart, where I change the game’s status in the database (from OPEN to STARTED). I can’t see any console.log or logger messages in the console, nor any messages on the client side, but the game status still changes.
@Process(JobNames.SCHEDULE_START_GAME)
async startGame(job: Job<any>) {
this.logger.log(`GAME ${job.data._id} START`);
const prevGameStance = job.data;
try {
const server = this.gameService.getServer();
this.logger.log(`Starting game ${prevGameStance._id}`);
const startedGame = await this.gameService.handleGameStart(
prevGameStance._id,
);
['waitingRoom', 'game'].forEach((room) => {
server.to(`${room}:${prevGameStance._id}`).emit('game:start', {
message: 'Game started',
game: startedGame,
});
});
return { success: true, from: 'backend' };
} catch (error) {
this.logger.error(`Error starting game ${prevGameStance._id}:`, error);
return { success: false, message: 'Failed to start game' };
}
}
The only place where it changes is in this function. And job from queue resolves successfully and this logs works properly.
@OnGlobalQueueCompleted()
onQueueCompleted(jobId: string) {
this.logger.log('--------------------------------');
this.logger.log(`Job ${jobId} completed`);
this.logger.log('--------------------------------');
}
So maybee someone can explain what it is? It's usually works like that when delay small (less than 5 minutes)
本文标签: typescriptDon39t understand strange behaviour of nestjsbullmqStack Overflow
版权声明:本文标题:typescript - Don't understand strange behaviour of nest.jsbullmq - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741445688a2379184.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论