feat: Update API versioning and parser handling for improved schedule updates and error management

This commit is contained in:
2026-10-19 23:29:35 +03:00
parent 85c5baa3e5
commit 68f9b95090
10 changed files with 32 additions and 18 deletions

View File

@@ -28,8 +28,9 @@ struct API: Sendable {
private static let log = Logger(subsystem: "org.xtimms.psu.schedule", category: "API")
private static let offline = "Нет связи с сервером расписания."
/// Server codes after which trying again later can help.
private static let sourceDown: Set<String> = ["source_unavailable", "source_timeout", "busy"]
/// Server codes after which trying again later can help: the university is down or slow, the
/// server is busy or did not answer in time, or this address sent too many requests.
private static let sourceDown: Set<String> = ["source_unavailable", "source_timeout", "busy", "timeout", "too_many_requests"]
private static let retries = 3
// The server answers "no-cache" with an ETag: URLSession keeps the answer and asks again