feat: shit shit
This commit is contained in:
@@ -1,32 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/joho/godotenv"
|
||||
"sipro-mps/internal/config"
|
||||
"sipro-mps/internal/tasks/types"
|
||||
"context"
|
||||
"fmt"
|
||||
"sipro-mps/internal/wb/products/mapping/generated"
|
||||
"strings"
|
||||
|
||||
pb "sipro-mps/api/generated/v1/wb/products"
|
||||
"sipro-mps/pkg/api/wb/client"
|
||||
|
||||
"github.com/deliveryhero/pipeline/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
godotenv.Load()
|
||||
cfg, err := config.LoadConfig()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
client := asynq.NewClient(asynq.RedisClientOpt{Addr: cfg.Redis.Host + ":" + cfg.Redis.Port, Password: cfg.Redis.Password})
|
||||
defer func(client *asynq.Client) {
|
||||
err := client.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
input := "1,2,3,4,5"
|
||||
|
||||
for out := range pipeline.Process(context.Background(), apply, pipeline.Emit(input)) {
|
||||
for j := range out {
|
||||
fmt.Printf("process: %s\n", out[j])
|
||||
}
|
||||
}(client)
|
||||
task, err := types.NewFetchProductsTask(types.TypeOzonFetchProducts, 930)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
info, err := client.Enqueue(task)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
println("Task enqueued successfully:", info.ID, "with queue name:", info.Queue, "and payload size:", len(info.Payload), "bytes")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user