Made auth middleware turn skip timeout if maintenance mode is on

This commit is contained in:
2025-02-17 23:31:09 +11:00
parent 556c93fc49
commit 9ea58b0961
4 changed files with 38 additions and 28 deletions

View File

@@ -11,7 +11,6 @@ import (
"github.com/rs/zerolog"
)
// A helper function to create a transaction with a cancellable context.
func WithTransaction(
w http.ResponseWriter,
r *http.Request,
@@ -24,8 +23,7 @@ func WithTransaction(
r *http.Request,
),
) {
// Create a cancellable context from the request context
ctx, cancel := context.WithTimeout(r.Context(), 2*time.Second)
ctx, cancel := context.WithTimeout(r.Context(), 15*time.Second)
defer cancel()
// Start the transaction
@@ -41,6 +39,5 @@ func WithTransaction(
return
}
// Pass the context and transaction to the handler
handler(ctx, tx, w, r)
}