Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: skip timeout for blob upload (#2516)

Athurg Goothafd0e72e3763
diff --git a/server/server.go b/server/server.go
index c0e8fe853..abcb79208 100644
--- a/server/server.go
+++ b/server/server.go
@@ -72,7 +72,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
}))
e.Use(middleware.TimeoutWithConfig(middleware.TimeoutConfig{
- Skipper: grpcRequestSkipper,
+ Skipper: timeoutSkipper,
Timeout: 30 * time.Second,
}))
@@ -186,3 +186,12 @@ func (s *Server) getSystemSecretSessionName(ctx context.Context) (string, error)
func grpcRequestSkipper(c echo.Context) bool {
return strings.HasPrefix(c.Request().URL.Path, "/memos.api.v2.")
}
+
+func timeoutSkipper(c echo.Context) bool {
+ if grpcRequestSkipper(c) {
+ return true
+ }
+
+ // Skip timeout for blob upload which is frequently timed out.
+ return c.Request().Method == http.MethodPost && c.Request().URL.Path == "/api/v1/resource/blob"
+}