mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-05 03:02:56 +00:00
dev day #89
This commit is contained in:
@@ -15,10 +15,10 @@ func DBContext() gin.HandlerFunc {
|
||||
// 15 seconds is generous for most queries while preventing indefinite hangs
|
||||
ctx, cancel := context.WithTimeout(c.Request.Context(), 15*time.Second)
|
||||
defer cancel()
|
||||
|
||||
|
||||
// Store the context so controllers can use it with db.WithContext(ctx)
|
||||
c.Set("dbCtx", ctx)
|
||||
|
||||
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user