chore: let user know about 429 status (#2747)

This commit is contained in:
Aman Harwara
2024-01-05 22:13:54 +05:30
committed by GitHub
parent 121d07288a
commit afaf53a7a4
5 changed files with 14 additions and 1 deletions

View File

@@ -100,6 +100,7 @@ import { ContentType } from '@standardnotes/domain-core'
const DEFAULT_MAJOR_CHANGE_THRESHOLD = 15
const INVALID_SESSION_RESPONSE_STATUS = 401
const TOO_MANY_REQUESTS_RESPONSE_STATUS = 429
const DEFAULT_AUTO_SYNC_INTERVAL = 30_000
/** Content types appearing first are always mapped first */
@@ -1000,6 +1001,10 @@ export class SyncService
void this.notifyEvent(SyncEvent.InvalidSession)
}
if (response.status === TOO_MANY_REQUESTS_RESPONSE_STATUS) {
void this.notifyEvent(SyncEvent.TooManyRequests)
}
this.opStatus?.setError(response.error)
void this.notifyEvent(SyncEvent.SyncError, response)