From 3bff97bbe8e0127725bf4b364dc90e1a421ff996 Mon Sep 17 00:00:00 2001 From: fengkx Date: Mon, 24 Dec 2018 08:04:33 +0800 Subject: [PATCH] answer callback when success with id set error_count to 0 when success update README --- proxies/rssFeed.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/proxies/rssFeed.js b/proxies/rssFeed.js index 49686e7c025..2cabb768e4d 100644 --- a/proxies/rssFeed.js +++ b/proxies/rssFeed.js @@ -101,6 +101,17 @@ px.getSubscribedFeedsByUserId = async (userId) => { } }; +px.resetErrorCount = async (feedUrl) => { + try { + const db = await dbPomise; + await db.run(`UPDATE rss_feed + SET error_count=0 + WHERE url = ?`, feedUrl); + } catch (e) { + throw new Error('DB_ERROR'); + } +}; + px.failAttempt = async (feedUrl) => { try { const db = await dbPomise; @@ -117,7 +128,9 @@ px.failAttempt = async (feedUrl) => { px.unsubAll = async (userId) => { try { const db = await dbPomise; - await db.run(`DELETE FROM subscribes WHERE user_id=?`, userId); + await db.run(`DELETE + FROM subscribes + WHERE user_id = ?`, userId); return 'ok'; } catch (e) { throw new Error('DB_ERROR');