diff options
author | 2023-08-15 17:01:01 +0100 | |
---|---|---|
committer | 2023-08-15 17:01:01 +0100 | |
commit | e9c3663ccebee8f4bc7fc7132bb3c06514066a3a (patch) | |
tree | e543a9ea13f1c387f8a134a647abd6d707cc043c /internal/middleware/requestid.go | |
parent | [bugfix] fix inconsistent calculated cache sizes (#2115) (diff) | |
download | gotosocial-e9c3663ccebee8f4bc7fc7132bb3c06514066a3a.tar.xz |
[chore] ensure worker contexts have request ID (#2120)
Diffstat (limited to 'internal/middleware/requestid.go')
-rw-r--r-- | internal/middleware/requestid.go | 14 |
1 files changed, 6 insertions, 8 deletions
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) } |