mirror of
https://github.com/karl0ss/JDRssDownloader.git
synced 2025-04-27 20:03:40 +01:00
21 lines
696 B
JavaScript
21 lines
696 B
JavaScript
const fs = require('fs')
|
|
|
|
function retryCache(cache) {
|
|
if (cache == null) {
|
|
retryCacheData = JSON.parse(fs.readFileSync('./cache/retryCache.json'));
|
|
return retryCacheData
|
|
}
|
|
retryCacheData = JSON.parse(fs.readFileSync('./cache/retryCache.json'));
|
|
if (retryCacheData.some(e => e.title === cache.title)) {
|
|
log.info(cache.title + ' is already in the retry cache.')
|
|
}
|
|
else {
|
|
cache.retryCount = 5
|
|
retryCacheData.push(cache)
|
|
fs.writeFileSync('./cache/retryCache.json', JSON.stringify(retryCacheData));
|
|
log.info(cache.title + ' written to retry cache.')
|
|
return retryCacheData
|
|
}
|
|
}
|
|
|
|
module.exports = { retryCache } |