Skip to content

Commit

Permalink
perf: add MCache
Browse files Browse the repository at this point in the history
  • Loading branch information
vm-001 committed Oct 14, 2024
1 parent 1d9251a commit 7f89329
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,13 @@ func (app *Application) initialize() error {
}
app.db = db

metrics, err := metrics.New(cfg.MetricsConfig)
if err != nil {
return err
}
app.metrics = metrics

// queue
queue := taskqueue.NewRedisQueue(taskqueue.RedisTaskQueueOptions{
Client: client,
}, app.log, metrics)
}, app.log)
app.queue = queue

app.dispatcher = dispatcher.NewDispatcher(log.Sugar(), queue, db, metrics)
app.dispatcher = dispatcher.NewDispatcher(log.Sugar(), queue, db)

// worker
if cfg.WorkerConfig.Enabled {
Expand All @@ -120,7 +114,7 @@ func (app *Application) initialize() error {
PoolConcurrency: int(cfg.WorkerConfig.Pool.Concurrency),
}
deliverer := deliverer.NewHTTPDeliverer(&cfg.WorkerConfig.Deliverer)
app.worker = worker.NewWorker(opts, db, deliverer, queue, app.metrics)
app.worker = worker.NewWorker(opts, db, deliverer, queue)
}

// admin
Expand All @@ -131,7 +125,7 @@ func (app *Application) initialize() error {

// gateway
if cfg.ProxyConfig.IsEnabled() {
app.gateway = proxy.NewGateway(&cfg.ProxyConfig, db, app.dispatcher, app.metrics)
app.gateway = proxy.NewGateway(&cfg.ProxyConfig, db, app.dispatcher)
}

return nil
Expand All @@ -153,7 +147,6 @@ func (app *Application) Start() error {
if err := app.bus.Start(); err != nil {
return err

Check warning on line 148 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L148

Added line #L148 was not covered by tests
}

if app.admin != nil {
app.admin.Start()
}
Expand Down Expand Up @@ -188,6 +181,7 @@ func (app *Application) Stop() error {
app.log.Infof("stopped")
}()

app.bus.Stop()

Check failure on line 184 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `app.bus.Stop` is not checked (errcheck)
// TODO: timeout
if app.admin != nil {
app.admin.Stop()
Expand All @@ -199,10 +193,6 @@ func (app *Application) Stop() error {
app.worker.Stop()
}

if app.metrics != nil {
app.metrics.Stop()
}

app.started = false
app.stop <- struct{}{}

Expand Down

0 comments on commit 7f89329

Please sign in to comment.