diff --git a/src/server/cache/index.ts b/src/server/cache/index.ts index cf171bb..7bd6362 100644 --- a/src/server/cache/index.ts +++ b/src/server/cache/index.ts @@ -37,7 +37,9 @@ export function buildQueryWithCache( const realValue = await fetchFn(...args); - await cacheManager.set(key, JSON.stringify(cachedValue)); + if (realValue) { + await cacheManager.set(key, JSON.stringify(realValue)); + } return realValue; }; diff --git a/src/server/model/feed/event.ts b/src/server/model/feed/event.ts index f13841c..7e2bf76 100644 --- a/src/server/model/feed/event.ts +++ b/src/server/model/feed/event.ts @@ -10,6 +10,7 @@ import { serializeJSON } from '../../utils/json'; import { buildQueryWithCache } from '../../cache'; import { sendNotification } from '../notification'; import { token } from '../notification/token'; +import { logger } from '../../utils/logger'; const { get: getFeedEventNotify, del: delFeedEventNotifyCache } = buildQueryWithCache(async (channelId: string) => { @@ -69,7 +70,9 @@ export async function sendFeedEventsNotify( await Promise.all( notifications.map((notification) => - sendNotification(notification, 'Feed Report', eventTokens) + sendNotification(notification, 'Feed Report', eventTokens).catch((err) => + logger.error('[Notification] sendFeedEventsNotify', err) + ) ) ); }