mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-03 14:18:42 +00:00
Endpoint that blocks until there are running builds
This commit is contained in:
parent
d39dd6f2ff
commit
8bb5770636
2 changed files with 14 additions and 0 deletions
|
@ -158,6 +158,10 @@ func Load(mux *httptreemux.ContextMux, middleware ...gin.HandlerFunc) http.Handl
|
|||
session.MustAdmin(),
|
||||
server.ResumeQueue,
|
||||
)
|
||||
queue.GET("/norunningbuilds",
|
||||
session.MustAdmin(),
|
||||
server.BlockTilQueueHasRunningItem,
|
||||
)
|
||||
}
|
||||
|
||||
auth := e.Group("/authorize")
|
||||
|
|
|
@ -62,6 +62,16 @@ func ResumeQueue(c *gin.Context) {
|
|||
c.Status(http.StatusOK)
|
||||
}
|
||||
|
||||
func BlockTilQueueHasRunningItem(c *gin.Context) {
|
||||
for {
|
||||
info := Config.Services.Queue.Info(c)
|
||||
if info.Stats.Running == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
c.Status(http.StatusOK)
|
||||
}
|
||||
|
||||
func PostHook(c *gin.Context) {
|
||||
remote_ := remote.FromContext(c)
|
||||
|
||||
|
|
Loading…
Reference in a new issue