Browse Source

fix: catch errors

nc-fix/error-handling
DarkPhoenix2704 6 months ago
parent
commit
de2d07eac4
  1. 16
      packages/nocodb/src/redis/pubsub-redis.ts

16
packages/nocodb/src/redis/pubsub-redis.ts

@ -23,9 +23,19 @@ export class PubSubRedis {
PubSubRedis.redisSubscriber = new Redis(process.env.NC_REDIS_JOB_URL);
PubSubRedis.redisSubscriber.on('message', async (channel, message) => {
const [command, ...args] = message.split(':');
const callback = PubSubRedis.callbacks[command];
if (callback) await callback(...args);
try {
if (!message || !message.includes(':')) {
return;
}
const [command, ...args] = message.split(':');
const callback = PubSubRedis.callbacks[command];
if (callback) {
await callback(...args);
}
} catch (error) {
PubSubRedis.logger.error('Error processing message', error);
}
});
PubSubRedis.initialized = true;

Loading…
Cancel
Save