mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
fix(app): jitter gateway reconnects and recover status nagbar (#2439)
This commit is contained in:
1 parent
b0645300ec
commit
cc3a9c8613
3 files changed
+24
-13
No files matched your search
@@ -90,7 +90,11 @@ const POLL_ACTIVE_MAINTENANCE_JITTER_MS = 15 * 1000;
|
||||
const POLL_AFTER_MAINTENANCE_START_MS = 5 * 1000;
|
||||
const POLL_MIN_DELAY_MS = 10 * 1000;
|
||||
const POLL_RESUME_STALE_MS = 30 * 1000;
|
||||
const STATUS_PAGE_FETCH_OPTIONS: RequestInit = {cache: 'no-store'};
|
||||
const STATUS_PAGE_FETCH_TIMEOUT_MS = 10 * 1000;
|
||||
|
||||
function statusPageFetchOptions(): RequestInit {
|
||||
return {cache: 'no-store', signal: AbortSignal.timeout(STATUS_PAGE_FETCH_TIMEOUT_MS)};
|
||||
}
|
||||
|
||||
export function computePollDelay(scheduledMaintenance: StatusPageMaintenance | null): number {
|
||||
if (scheduledMaintenance?.status === 'in_progress') {
|
||||
@@ -256,12 +260,8 @@ export class StatusPage {
|
||||
|
||||
private async fetchIncidents(): Promise<void> {
|
||||
try {
|
||||
const response = await fetch(`${ExternalUrls.SERVICE_STATUS}/summary.json`, STATUS_PAGE_FETCH_OPTIONS);
|
||||
const response = await fetch(`${ExternalUrls.SERVICE_STATUS}/summary.json`, statusPageFetchOptions());
|
||||
if (!response.ok) {
|
||||
runInAction(() => {
|
||||
this.incident = null;
|
||||
this.scheduledMaintenance = null;
|
||||
});
|
||||
return;
|
||||
}
|
||||
const data: InstatusSummary = await response.json();
|
||||
@@ -296,16 +296,12 @@ export class StatusPage {
|
||||
});
|
||||
} catch {
|
||||
logger.warn('Failed to fetch status page');
|
||||
runInAction(() => {
|
||||
this.incident = null;
|
||||
this.scheduledMaintenance = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private async fetchComponentMaintenances(): Promise<Array<InstatusMaintenance>> {
|
||||
try {
|
||||
const response = await fetch(`${ExternalUrls.SERVICE_STATUS}/components.json`, STATUS_PAGE_FETCH_OPTIONS);
|
||||
const response = await fetch(`${ExternalUrls.SERVICE_STATUS}/components.json`, statusPageFetchOptions());
|
||||
if (!response.ok) {
|
||||
return [];
|
||||
}
|
||||
@@ -321,6 +317,10 @@ export class StatusPage {
|
||||
this.incident = null;
|
||||
}
|
||||
|
||||
refreshForConnectionIssue(): void {
|
||||
this.refreshIfStale();
|
||||
}
|
||||
|
||||
private async refreshAndReschedule(): Promise<void> {
|
||||
try {
|
||||
await this.checkIncidents();
|
||||
|
||||
Reference in new issue
Block a user