Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/routes/status.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { RaidHubRoute } from "@/core/RaidHubRoute"
import { getDestiny2Status } from "@/integrations/bungie"
import { InternalApiError } from "@/lib/utils/internal-api-client"
import { Logger } from "@/lib/utils/logging"
import { cacheControl } from "@/middleware/cache-control"
import {
AtlasStatus,
Expand All @@ -15,6 +16,8 @@
import { getLatestInstanceByDate } from "@/services/instance/latest"
import { z } from "zod"

const logger = new Logger("STATUS_ROUTE")

// This state tracks the status of the Destiny API and debounces it with a grace period of 60 seconds.
export const statusState = {
debounce: 60000,
Expand Down Expand Up @@ -101,13 +104,20 @@
AtlasPGCR: atlasPGCR,
FloodgatesPGCR: floodgatesPGCR
})
} catch (err) {
if (err instanceof InternalApiError) {

Check warning on line 108 in src/routes/status.ts

View workflow job for this annotation

GitHub Actions / test

107-108 lines are not covered with tests
// log the error as a error for sentry

Copilot AI Feb 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline comment has a grammar/spelling issue and is a bit unclear. Consider updating it to “log the error as an error for Sentry” (or rephrasing to note that Logger.error captures to Sentry).

Suggested change
// log the error as a error for sentry
// Log the error as an error in Sentry (via Logger.error)

Copilot uses AI. Check for mistakes.
logger.error("INTERNAL_API_ERROR", err, {
serviceName: err.serviceName,
url: err.url.toString(),
status: err.status,
statusText: err.statusText
})
return RaidHubRoute.fail(ErrorCode.ServiceUnavailableError, {
serviceName: err.serviceName,
message: "Internal service unavailable"
})
} else {

Check warning on line 120 in src/routes/status.ts

View workflow job for this annotation

GitHub Actions / test

110-120 lines are not covered with tests
throw err
}
}
Expand All @@ -123,7 +133,7 @@

if (isDestinyApiEnabled) {
statusState.debounceOnlineEvent()
} else {

Check warning on line 136 in src/routes/status.ts

View workflow job for this annotation

GitHub Actions / test

136 line is not covered with tests
statusState.debounceOfflineEvent()
}

Expand Down Expand Up @@ -183,7 +193,7 @@

const instance = await getInstanceBasic(latestInstanceId)
if (!instance) {
return null

Check warning on line 196 in src/routes/status.ts

View workflow job for this annotation

GitHub Actions / test

196 line is not covered with tests
}

return {
Expand Down Expand Up @@ -216,8 +226,8 @@
backlog === 0 &&
floodgatesStatus.ackRateSeconds > 0 &&
floodgatesStatus.ingressRateSeconds > 0
) {
status = "Live"

Check warning on line 230 in src/routes/status.ts

View workflow job for this annotation

GitHub Actions / test

229-230 lines are not covered with tests
}

return {
Expand Down