From 2a2f783c33f1cfa358a82687da3b00dc5c85a084 Mon Sep 17 00:00:00 2001 From: davidvader Date: Fri, 24 Feb 2023 15:18:55 -0600 Subject: [PATCH] wip: added comments --- api/register.go | 2 -- cmd/vela-worker/server.go | 3 +++ router/router.go | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/register.go b/api/register.go index f541baebc..15fcceb7a 100644 --- a/api/register.go +++ b/api/register.go @@ -6,8 +6,6 @@ import ( "github.com/gin-gonic/gin" ) -var idx = 1 - func Register(c *gin.Context) { // extract the deadloop channel that was packed into gin context diff --git a/cmd/vela-worker/server.go b/cmd/vela-worker/server.go index 9ab9d03bd..8ca295fec 100644 --- a/cmd/vela-worker/server.go +++ b/cmd/vela-worker/server.go @@ -34,6 +34,9 @@ func (w *Worker) server() (http.Handler, *tls.Config) { middleware.Executors(w.Executors), middleware.Secret(w.Config.Server.Secret), middleware.Logger(logrus.StandardLogger(), time.RFC3339, true), + + // middleware that puts the deadloop channel in the gin context + // this lets us send messages back to operate.go func(c *gin.Context) { c.Set("deadloop", w.Deadloop) c.Next() diff --git a/router/router.go b/router/router.go index 1c1f183a2..227fc9665 100644 --- a/router/router.go +++ b/router/router.go @@ -110,6 +110,5 @@ func Load(options ...gin.HandlerFunc) *gin.Engine { // endpoint for passing a new registration token to the deadloop running operate.go r.GET("/register", api.Register) - return r }