skip transaction for POST /service/token (#19339)

Habor doesnot support POST /service/token endpoint,
put this request into a transaction will consume
extra database resources and generate many logs.

Signed-off-by: bin liu <liubin0329@gmail.com>
This commit is contained in:
Bin Liu 2024-01-19 15:11:32 +08:00 committed by GitHub
parent ee6f61c502
commit 5a576174b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -55,6 +55,7 @@ var (
dbTxSkippers = []middleware.Skipper{
middleware.MethodAndPathSkipper(http.MethodPatch, distribution.BlobUploadURLRegexp),
middleware.MethodAndPathSkipper(http.MethodPut, distribution.BlobUploadURLRegexp),
middleware.MethodAndPathSkipper(http.MethodPost, match("^/service/token")),
func(r *http.Request) bool { // skip tx for GET, HEAD and Options requests
m := r.Method
return m == http.MethodGet || m == http.MethodHead || m == http.MethodOptions