fix: fix problem of send notification
This commit is contained in:
parent
a2cb8b0538
commit
82bb2ad267
4
src/server/cache/index.ts
vendored
4
src/server/cache/index.ts
vendored
@ -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;
|
||||
};
|
||||
|
@ -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)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user