log enabled dep

This commit is contained in:
nquidox 2026-04-08 12:15:24 +03:00
parent c5013c03ff
commit b29e60b712
6 changed files with 39 additions and 21 deletions

View file

@ -33,8 +33,8 @@ func NewApp(ctx context.Context, cfg config.Config) *App {
Pass: cfg.Rabbit.Pass,
Vhost: cfg.Rabbit.Vhost,
},
ChanLen: cfg.App.ProcChanLen,
LoggerEnabled: false,
LoggingEnabled: cfg.Rabbit.LoggingEnabled,
ChanLen: cfg.App.ProcChanLen,
})
return &App{
@ -53,11 +53,13 @@ func (app *App) Run(ctx context.Context) error {
defer mainLoop.Stop()
go func() {
log.Info("Process tasks after start")
if err := app.processor.ProcessTasks(ctx); err != nil {
errChan <- err
}
for range mainLoop.C {
log.WithField("period", app.config.App.CheckPeriod).Info("Repeated process tasks")
if err := app.processor.ProcessTasks(ctx); err != nil {
errChan <- err
}

View file

@ -20,11 +20,11 @@ type Addr struct {
}
type Deps struct {
Ctx context.Context
TA taskAgent.TaskAgent
Addr Addr
ChanLen uint
LoggerEnabled bool
Ctx context.Context
TA taskAgent.TaskAgent
Addr Addr
ChanLen uint
LoggingEnabled bool
}
func NewHandler(deps Deps) Processor {

View file

@ -30,7 +30,7 @@ func newService(deps Deps) *service {
s := &service{
taskAgent: deps.TA,
brokerAddr: ba,
rabbitLoggingEnabled: deps.LoggerEnabled,
rabbitLoggingEnabled: deps.LoggingEnabled,
}
s.makeTaskPublishers(deps.Ctx, ba, deps.ChanLen)