29 lines
1.9 KiB
TypeScript
29 lines
1.9 KiB
TypeScript
import { DataEndpoint, ExpectedContentType } from "./types";
|
|
|
|
type DataEndpointConfig = {
|
|
expectedContentType: ExpectedContentType;
|
|
timeoutMs: number;
|
|
slowMs: number;
|
|
allowStale: boolean;
|
|
};
|
|
|
|
export const DATA_ENDPOINT_CONFIG: Record<DataEndpoint, DataEndpointConfig> = {
|
|
positions_current: { expectedContentType: "json", timeoutMs: 8000, slowMs: 2500, allowStale: true },
|
|
positions_master: { expectedContentType: "json", timeoutMs: 8000, slowMs: 2500, allowStale: true },
|
|
positions_gas_fallback: { expectedContentType: "json", timeoutMs: 8000, slowMs: 2500, allowStale: true },
|
|
positions_webview: { expectedContentType: "json", timeoutMs: 8000, slowMs: 2500, allowStale: true },
|
|
operation_info_flag: { expectedContentType: "json", timeoutMs: 10000, slowMs: 3000, allowStale: true },
|
|
operation_info_text: { expectedContentType: "text", timeoutMs: 15000, slowMs: 5000, allowStale: true },
|
|
operation_logs: { expectedContentType: "json", timeoutMs: 15000, slowMs: 3000, allowStale: true },
|
|
train_operation_data: { expectedContentType: "json", timeoutMs: 15000, slowMs: 3500, allowStale: true },
|
|
timetable_today: { expectedContentType: "json", timeoutMs: 15000, slowMs: 3500, allowStale: true },
|
|
positions: { expectedContentType: "json", timeoutMs: 8000, slowMs: 2500, allowStale: true },
|
|
operation_info: { expectedContentType: "json", timeoutMs: 10000, slowMs: 3000, allowStale: true },
|
|
train_operation: { expectedContentType: "json", timeoutMs: 10000, slowMs: 3500, allowStale: true },
|
|
timetable: { expectedContentType: "json", timeoutMs: 10000, slowMs: 3500, allowStale: true },
|
|
station_info: { expectedContentType: "json", timeoutMs: 8000, slowMs: 2500, allowStale: true },
|
|
notice: { expectedContentType: "json", timeoutMs: 8000, slowMs: 2500, allowStale: true },
|
|
app_config: { expectedContentType: "json", timeoutMs: 8000, slowMs: 2000, allowStale: false },
|
|
unknown: { expectedContentType: "any", timeoutMs: 8000, slowMs: 3000, allowStale: false },
|
|
};
|