Skip to content

Commit

Permalink
answer callback when success with id
Browse files Browse the repository at this point in the history
set error_count to 0 when success
update README
  • Loading branch information
fengkx committed Dec 24, 2018
1 parent be60e1a commit 3bff97b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion proxies/rssFeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');
Expand Down

0 comments on commit 3bff97b

Please sign in to comment.