// Pull is a long request that polls and attemts to pull work off the queue stack. func Pull(c *gin.Context) { logrus.Debugf("Agent %s connected.", c.ClientIP()) w := queue.PullClose(c, c.Writer) if w == nil { logrus.Debugf("Agent %s could not pull work.", c.ClientIP()) } else { c.JSON(202, w) logrus.Debugf("Agent %s assigned work. %s/%s#%d.%d", c.ClientIP(), w.Repo.Owner, w.Repo.Name, w.Build.Number, w.Job.Number, ) } }
// Pull is a long request that polls and attemts to pull work off the queue stack. func Pull(c *gin.Context) { logrus.Debugf("Agent %s connected.", c.ClientIP()) w := queue.PullClose(c, c.Writer) if w == nil { logrus.Debugf("Agent %s could not pull work.", c.ClientIP()) } else { // setup the channel to stream logs if err := stream.Create(c, stream.ToKey(w.Job.ID)); err != nil { logrus.Errorf("Unable to create stream. %s", err) } c.JSON(202, w) logrus.Debugf("Agent %s assigned work. %s/%s#%d.%d", c.ClientIP(), w.Repo.Owner, w.Repo.Name, w.Build.Number, w.Job.Number, ) } }