Skip to content

Commit

Permalink
fix(feed): replicate all feed record on new feed
Browse files Browse the repository at this point in the history
  • Loading branch information
DEgITx committed Jul 22, 2018
1 parent 27fa805 commit 3e4460f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/background/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ module.exports = async ({
vote: action,
_index: `vote:${hash}`,
_temp: {
torrent: await getTorrent(sphinx, hash)
torrent: setupTorrentRecord(await getTorrent(sphinx, hash))
}
}), 0)
good += isGood ? 1 : 0
Expand Down Expand Up @@ -967,6 +967,8 @@ module.exports = async ({
console.log('replace our feed with remote feed')
feed.feed = remoteFeed.feed
feed.feedDate = remoteFeed.feedDate || 0
// it can be new torrents replicate all
feed.feed.forEach(torrent => insertTorrentToDB(torrent, true))
send('feedUpdate', {
feed: feed.feed
});
Expand Down
2 changes: 2 additions & 0 deletions src/background/spider.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ app.get('*', function(req, res)
// feed date clean
if(typeof torrent.feedDate !== 'undefined')
delete torrent.feedDate

return torrent
}

const insertTorrentToDB = (torrent, silent) => new Promise((resolve) => {
Expand Down

0 comments on commit 3e4460f

Please sign in to comment.