mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 07:33:21 +00:00
Print fsync warning only once
The repo.Handler is freshly instantiated for every request such that it forget that the fsync warning was already printed. Use a single instance in the Server instead.
This commit is contained in:
parent
b2e8044fbd
commit
be14687a9c
2 changed files with 5 additions and 3 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/restic/rest-server/quota"
|
||||
"github.com/restic/rest-server/repo"
|
||||
|
@ -34,6 +35,7 @@ type Server struct {
|
|||
|
||||
htpasswdFile *HtpasswdFile
|
||||
quotaManager *quota.Manager
|
||||
fsyncWarning sync.Once
|
||||
}
|
||||
|
||||
// MaxFolderDepth is the maxDepth param passed to splitURLPath.
|
||||
|
@ -91,6 +93,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
QuotaManager: s.quotaManager, // may be nil
|
||||
PanicOnError: s.PanicOnError,
|
||||
NoVerifyUpload: s.NoVerifyUpload,
|
||||
FsyncWarning: &s.fsyncWarning,
|
||||
}
|
||||
if s.Prometheus {
|
||||
opt.BlobMetricFunc = makeBlobMetricFunc(username, folderPath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue