refresh sa_tokens every 12 hours

This commit is contained in:
liaojack8 2020-07-07 01:33:14 +08:00
parent 769093719e
commit b74425f882
1 changed files with 5 additions and 0 deletions

View File

@ -22,6 +22,11 @@ const SA_FILES = fs.readdirSync(path.join(__dirname, SA_PATH)).filter(v => v.end
SA_FILES.flag = 0
let SA_TOKENS = get_sa_batch()
setInterval(() => {
SA_FILES.flag = 0
SA_TOKENS = get_sa_batch()
}, 1000 * 3600 * 12)
function get_sa_batch () {
const new_flag = SA_FILES.flag + SA_BATCH_SIZE
const files = SA_FILES.slice(SA_FILES.flag, new_flag)