refactor: Fix linter errors
This commit is contained in:
@@ -75,8 +75,7 @@ func (c *Connection) listenCloseNotify() {
|
|||||||
))
|
))
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
<-c.closeNotify
|
||||||
case <-c.closeNotify:
|
|
||||||
c.logger.Info("Trying to reconnect to rabbit")
|
c.logger.Info("Trying to reconnect to rabbit")
|
||||||
|
|
||||||
dial, dialErr := amqp.Dial(c.connString)
|
dial, dialErr := amqp.Dial(c.connString)
|
||||||
@@ -91,9 +90,6 @@ func (c *Connection) listenCloseNotify() {
|
|||||||
|
|
||||||
c.logger.Info("Rabbit connection stabilized")
|
c.logger.Info("Rabbit connection stabilized")
|
||||||
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
time.Sleep(c.reconnectInterval)
|
time.Sleep(c.reconnectInterval)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type ContextKey string
|
||||||
|
|
||||||
|
const (
|
||||||
|
UserContextKey ContextKey = "user"
|
||||||
|
)
|
||||||
|
|
||||||
func SetUserFromJWT() gin.HandlerFunc {
|
func SetUserFromJWT() gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
ctx := c.Request.Context()
|
ctx := c.Request.Context()
|
||||||
@@ -34,7 +40,7 @@ func SetUserFromJWT() gin.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = context.WithValue(ctx, "user", user)
|
ctx = context.WithValue(ctx, UserContextKey, user)
|
||||||
|
|
||||||
c.Request = c.Request.WithContext(ctx)
|
c.Request = c.Request.WithContext(ctx)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user