feat(server): properly reschedule jobs after polling

This commit is contained in:
Jef Roosens 2022-12-12 20:59:43 +01:00 committed by Chewing_Bever
parent c57de4d8ee
commit 0a5c4295e0
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
2 changed files with 45 additions and 11 deletions

View file

@ -6,8 +6,8 @@ import web.response { new_data_response, new_response }
// import util
// import models { BuildLog, BuildLogFilter }
['/api/v1/builds/poll'; auth; get]
fn (mut app App) v1_poll_build_queue() web.Result {
['/api/v1/jobs/poll'; auth; get]
fn (mut app App) v1_poll_job_queue() web.Result {
arch := app.query['arch'] or {
return app.json(.bad_request, new_response('Missing arch query arg.'))
}
@ -17,7 +17,7 @@ fn (mut app App) v1_poll_build_queue() web.Result {
}
max := max_str.int()
mut out := app.job_queue.pop_n(arch, max)
mut out := app.job_queue.pop_n(arch, max).map(it.config)
return app.json(.ok, new_data_response(out))
}