Skip to content

Commit

Permalink
fix(update-tokens): minor fix debugging queue queue positions
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Mar 8, 2021
1 parent 8ea78e0 commit a1e4f3e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/services/update-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ const updateTokens = client => {
let queue = 0
const handleRefreshToken = row => {
queue++
const queuePosition = queue
if (debug) {
debug(`Refresh ${queue}° token for store #${row.store_id}`)
}

setTimeout(() => {
// start app authentication flux
const reqPromise = refreshToken(row.store_id, row.authentication_id)
Expand All @@ -34,12 +37,11 @@ const updateTokens = client => {
})

if (debug) {
debug(`Refresh ${queuePosition}° token for store #${row.store_id}`)
reqPromise.then(() => {
debug(`✓ Access token updated with success for store #${row.store_id}`)
})
}
}, queuePosition * 1000)
}, queue * 1000)
}

const task = () => {
Expand Down

0 comments on commit a1e4f3e

Please sign in to comment.