Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Commit

Permalink
Add metadata update automation
Browse files Browse the repository at this point in the history
  • Loading branch information
seia-soto committed Feb 14, 2020
1 parent f3893bb commit b41f543
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ module.exports = {
}
},
ohys: {
passUpdateAtStart: true,
refreshRate: 30 * 1000
},
anilist: {
api: 'https://graphql.anilist.co'
api: 'https://graphql.anilist.co',
refreshRate: 2 * 60 * 60 * 1000
}
}
3 changes: 2 additions & 1 deletion utils/anilist/worker/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const config = require('../../../config')
const log = require('../../../log')
const crypto = require('../../crypto')
const database = require('../../database')
Expand Down Expand Up @@ -71,7 +72,7 @@ class AnilistWorker {
hash: crypto.hash.md5(data[k].series)
})

if (!list.includes(data[k].series) && !existingMeta.length) {
if ((!list.includes(data[k].series) && !existingMeta.length) || Date.now() - new Date(existingMeta[0].updated_at) > config.anilist.refreshRate) {
list.push(data[k].series)
this.enqueue(data[k].series)
}
Expand Down

0 comments on commit b41f543

Please sign in to comment.