mirror of
https://github.com/usememos/memos.git
synced 2024-12-28 08:03:01 +08:00
chore: skip timeout for blob upload (#2516)
Skip timeout for blob upload
This commit is contained in:
parent
d758ba2702
commit
afd0e72e37
1 changed files with 10 additions and 1 deletions
|
@ -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"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue