Refactor marketplace product fetching and caching logic; update environment configuration for Redis and PostgreSQL

This commit is contained in:
2025-07-07 19:20:05 +03:00
parent c7be7e2cea
commit 3976c7d0cf
22 changed files with 319 additions and 349 deletions

View File

@@ -4,6 +4,7 @@ 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"
)
@@ -24,13 +25,14 @@ func (s *AsynqServer) createMux() *asynq.ServeMux {
// Register task handlers here
mux.Handle(types.TypeWbFetchProducts, &wb.FetchProductsProcessor{Dbpool: s.dbpool})
mux.Handle(types.TypeOzonFetchProducts, &ozon.FetchProductsProcessor{Dbpool: s.dbpool})
return mux
}
func (s *AsynqServer) Run() {
srv := asynq.NewServer(
asynq.RedisClientOpt{Addr: s.redisConfig.Addr, Password: s.redisConfig.Password},
asynq.Config{Concurrency: 10},
asynq.Config{},
)
mux := s.createMux()
if err := srv.Run(mux); err != nil {