From e9c3663ccebee8f4bc7fc7132bb3c06514066a3a Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 15 Aug 2023 17:01:01 +0100 Subject: [chore] ensure worker contexts have request ID (#2120) --- internal/middleware/requestid.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'internal/middleware') diff --git a/internal/middleware/requestid.go b/internal/middleware/requestid.go index 3bf38092f..00b1ff299 100644 --- a/internal/middleware/requestid.go +++ b/internal/middleware/requestid.go @@ -39,8 +39,8 @@ var ( base32enc = base32.NewEncoding("0123456789abcdefghjkmnpqrstvwxyz").WithPadding(-1) ) -// generateID generates a new ID string. -func generateID() string { +// NewRequestID generates a new request ID string. +func NewRequestID() string { // 0:8 = timestamp // 8:12 = entropy // @@ -69,12 +69,10 @@ func AddRequestID(header string) gin.HandlerFunc { // Have we found anything? if id == "" { // Generate new ID. - // - // 0:8 = timestamp - // 8:12 = entropy - id = generateID() - // Set the request ID in the req header in case we pass the request along - // to another service + id = NewRequestID() + + // Set the request ID in the req header in case + // we pass the request along to another service. c.Request.Header.Set(header, id) } -- cgit v1.2.3