Skip to content

Commit 88b0c7a

Browse files
committed
fix error notfiy too many times
1 parent e20edb4 commit 88b0c7a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

utils/fetch.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const {
1212
getFeedByUrl,
1313
resetErrorCount
1414
} = require('../proxies/rssFeed');
15+
const { notify_error_count } = require('../config');
1516

1617
const fetch = async (feedUrl) => {
1718
try {
@@ -29,7 +30,11 @@ const fetch = async (feedUrl) => {
2930
} catch (e) {
3031
await failAttempt(feedUrl);
3132
getFeedByUrl(feedUrl).then((feed) => {
32-
if (feed.error_count >= 5) {
33+
const round_time = notify_error_count * 10;
34+
const round_happen =
35+
feed.error_count % round_time === 0 &&
36+
feed.error_count > round_time;
37+
if (feed.error_count === notify_error_count || round_happen) {
3338
logger.info(feed, 'ERROR_MANY_TIME');
3439
process.send({
3540
success: false,

0 commit comments

Comments
 (0)