fix: fix problem of send notification

This commit is contained in:
moonrailgun 2024-07-17 00:38:21 +08:00
parent a2cb8b0538
commit 82bb2ad267
2 changed files with 7 additions and 2 deletions

View File

@ -37,7 +37,9 @@ export function buildQueryWithCache<T, Args extends any[]>(
const realValue = await fetchFn(...args);
await cacheManager.set(key, JSON.stringify(cachedValue));
if (realValue) {
await cacheManager.set(key, JSON.stringify(realValue));
}
return realValue;
};

View File

@ -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)
)
)
);
}