Skip to content

Commit

Permalink
log when browser offline
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajmajerik committed Oct 24, 2023
1 parent 07766f8 commit c6c457f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/retry-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ export class RetryQueue extends RequestQueueScaffold {
const retryAt = new Date(Date.now() + msToNextRetry)

this.queue.push({ retryAt, requestData })
logger.warn(`Enqueued failed request for retry in ${msToNextRetry}`)

let logMessage = `Enqueued failed request for retry in ${msToNextRetry}`
if (!navigator.onLine) {
logMessage += ' (Browser is offline)'
}
logger.warn(logMessage)

if (!this.isPolling) {
this.isPolling = true
this.poll()
Expand Down

0 comments on commit c6c457f

Please sign in to comment.