mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
Endpoint that blocks until there are running builds
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user