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
13 changes: 10 additions & 3 deletions src/main/kotlin/zed/rainxch/githubstore/routes/InternalRoutes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fun Route.internalRoutes(
call.response.header(HttpHeaders.RetryAfter, "60")
return@post call.respond(
HttpStatusCode.Conflict,
mapOf("error" to "backfill_already_running"),
BackfillResponse(scheduled = 0, started = false, message = "backfill_already_running"),
)
}
val candidates = transaction {
Expand All @@ -139,7 +139,7 @@ fun Route.internalRoutes(
backfillRunning.set(false)
return@post call.respond(
HttpStatusCode.OK,
mapOf("scheduled" to 0, "message" to "no stale rows"),
BackfillResponse(scheduled = 0, started = false, message = "no stale rows"),
)
}
backfillScope.launch {
Expand All @@ -152,7 +152,7 @@ fun Route.internalRoutes(
call.response.header(HttpHeaders.CacheControl, "no-store")
call.respond(
HttpStatusCode.Accepted,
mapOf("scheduled" to candidates.size, "started" to true),
BackfillResponse(scheduled = candidates.size, started = true),
)
}

Expand Down Expand Up @@ -402,6 +402,13 @@ private suspend fun fetchTopReposByInstalls(): List<TopRepo> = newSuspendedTrans
out
}

@Serializable
data class BackfillResponse(
val scheduled: Int,
val started: Boolean,
val message: String? = null,
)

@Serializable
data class MetricsResponse(
val counters: SearchCounters,
Expand Down
Loading