Improve API4 initialization (#18680)
* Improve API4 initialization - Refactored openGraphDataCache to be inside app layer. - Moved the cache instance from global variable to be inside server. - Moved out the app instantiation from the global commands package to be instantiated on every call. Only the server instance is passed. - Moved InitLocal to be called from inside Init. ```release-note NONE ``` * Remove commented line ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
43a99a5783
Коммит
c27814393d
@@ -93,17 +93,14 @@ func runServer(configStore *config.Store, interruptChan chan os.Signal) error {
|
||||
}
|
||||
}()
|
||||
|
||||
a := app.New(app.ServerConnector(server.Channels()))
|
||||
api := api4.Init(a, server.Router)
|
||||
|
||||
api := api4.Init(server)
|
||||
wsapi.Init(server)
|
||||
web.New(a, server.Router)
|
||||
api4.InitLocal(a, server.LocalRouter)
|
||||
web.New(server)
|
||||
|
||||
serverErr := server.Start()
|
||||
if serverErr != nil {
|
||||
mlog.Critical(serverErr.Error())
|
||||
return serverErr
|
||||
err = server.Start()
|
||||
if err != nil {
|
||||
mlog.Critical(err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
// If we allow testing then listen for manual testing URL hits
|
||||
|
||||
@@ -58,7 +58,7 @@ func webClientTestsCmdF(command *cobra.Command, args []string) error {
|
||||
return serverErr
|
||||
}
|
||||
|
||||
api4.Init(a, a.Srv().Router)
|
||||
api4.Init(a.Srv())
|
||||
wsapi.Init(a.Srv())
|
||||
a.UpdateConfig(setupClientTests)
|
||||
runWebClientTests()
|
||||
@@ -79,7 +79,7 @@ func serverForWebClientTestsCmdF(command *cobra.Command, args []string) error {
|
||||
return serverErr
|
||||
}
|
||||
|
||||
api4.Init(a, a.Srv().Router)
|
||||
api4.Init(a.Srv())
|
||||
wsapi.Init(a.Srv())
|
||||
a.UpdateConfig(setupClientTests)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user