feat: configure Asynq server concurrency to improve task processing
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"sipro-mps/internal/config"
|
||||
"sipro-mps/internal/tasks/ozon"
|
||||
"sipro-mps/internal/tasks/types"
|
||||
"sipro-mps/internal/tasks/wb"
|
||||
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
type AsynqServer struct {
|
||||
@@ -32,7 +33,9 @@ func (s *AsynqServer) createMux() *asynq.ServeMux {
|
||||
func (s *AsynqServer) Run() {
|
||||
srv := asynq.NewServer(
|
||||
asynq.RedisClientOpt{Addr: s.redisConfig.Addr, Password: s.redisConfig.Password},
|
||||
asynq.Config{},
|
||||
asynq.Config{
|
||||
Concurrency: 2,
|
||||
},
|
||||
)
|
||||
mux := s.createMux()
|
||||
if err := srv.Run(mux); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user