From de2d07eac4da9159c2f116c55bcecd7139e0ea2a Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Fri, 7 Jun 2024 13:39:45 +0000 Subject: [PATCH] fix: catch errors --- packages/nocodb/src/redis/pubsub-redis.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/src/redis/pubsub-redis.ts b/packages/nocodb/src/redis/pubsub-redis.ts index 1b06f55459..1b639c3f4c 100644 --- a/packages/nocodb/src/redis/pubsub-redis.ts +++ b/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;