mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Enable keepalive for websocket connection (#1134)
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
|||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/99designs/gqlgen/handler"
|
"github.com/99designs/gqlgen/handler"
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
@@ -135,12 +136,14 @@ func Start() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
maxUploadSize := handler.UploadMaxSize(config.GetMaxUploadSize())
|
maxUploadSize := handler.UploadMaxSize(config.GetMaxUploadSize())
|
||||||
|
websocketKeepAliveDuration := handler.WebsocketKeepAliveDuration(10 * time.Second)
|
||||||
|
|
||||||
txnManager := manager.GetInstance().TxnManager
|
txnManager := manager.GetInstance().TxnManager
|
||||||
resolver := &Resolver{
|
resolver := &Resolver{
|
||||||
txnManager: txnManager,
|
txnManager: txnManager,
|
||||||
}
|
}
|
||||||
gqlHandler := handler.GraphQL(models.NewExecutableSchema(models.Config{Resolvers: resolver}), recoverFunc, websocketUpgrader, maxUploadSize)
|
|
||||||
|
gqlHandler := handler.GraphQL(models.NewExecutableSchema(models.Config{Resolvers: resolver}), recoverFunc, websocketUpgrader, websocketKeepAliveDuration, maxUploadSize)
|
||||||
|
|
||||||
r.Handle("/graphql", gqlHandler)
|
r.Handle("/graphql", gqlHandler)
|
||||||
r.Handle("/playground", handler.Playground("GraphQL playground", "/graphql"))
|
r.Handle("/playground", handler.Playground("GraphQL playground", "/graphql"))
|
||||||
|
|||||||
Reference in New Issue
Block a user