diff options
author | Chris <ccbrown112@gmail.com> | 2017-10-26 14:21:22 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-10-26 15:21:22 -0400 |
commit | 7ed011745a544873f40f806f1803cb8a4998ba01 (patch) | |
tree | fe13919b050b33c8dd3f6ca5fce6ad1980b2dd3e /app/app.go | |
parent | a0bfd2885d03e3f9fb6b3cdd6ba60eea93c848b2 (diff) | |
download | chat-7ed011745a544873f40f806f1803cb8a4998ba01.tar.gz chat-7ed011745a544873f40f806f1803cb8a4998ba01.tar.bz2 chat-7ed011745a544873f40f806f1803cb8a4998ba01.zip |
Remove more global refs / state (#7723)
* remove more global refs / state
* fix job enterprise initialization
* fix api4 test compilation
* saml api endpoints fix
Diffstat (limited to 'app/app.go')
-rw-r--r-- | app/app.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/app.go b/app/app.go index c82520cd9..002a6a272 100644 --- a/app/app.go +++ b/app/app.go @@ -48,6 +48,8 @@ type App struct { Saml einterfaces.SamlInterface newStore func() store.Store + + sessionCache *utils.Cache } var appCount = 0 @@ -64,10 +66,10 @@ func New(options ...Option) *App { app := &App{ goroutineExitSignal: make(chan struct{}, 1), - Jobs: &jobs.JobServer{}, Srv: &Server{ Router: mux.NewRouter(), }, + sessionCache: utils.NewLru(model.SESSION_CACHE_SIZE), } app.initEnterprise() @@ -82,7 +84,7 @@ func New(options ...Option) *App { } app.Srv.Store = app.newStore() - app.Jobs.Store = app.Srv.Store + app.initJobs() app.Srv.Router.NotFoundHandler = http.HandlerFunc(app.Handle404) @@ -218,6 +220,10 @@ func (a *App) initEnterprise() { if dataRetentionInterface != nil { a.DataRetention = dataRetentionInterface(a) } +} + +func (a *App) initJobs() { + a.Jobs = jobs.NewJobServer(a.Config, a.Srv.Store) if jobsDataRetentionJobInterface != nil { a.Jobs.DataRetentionJob = jobsDataRetentionJobInterface(a) } @@ -240,6 +246,10 @@ func (a *App) UpdateConfig(f func(*model.Config)) { f(utils.Cfg) } +func (a *App) ConfigFileName() string { + return utils.CfgFileName +} + // Go creates a goroutine, but maintains a record of it to ensure that execution completes before // the app is destroyed. func (a *App) Go(f func()) { |