feat: implement context handling with timeout and goroutine management

This commit is contained in:
2025-10-13 20:09:51 +03:00
parent 328b4cc66e
commit e911403bba
2 changed files with 23 additions and 31 deletions

View File

@@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"os"
"sipro-mps/internal/redis"
"sipro-mps/pkg/utils"
"time"
@@ -69,6 +70,9 @@ type RateLimitTransport struct {
func (t *RateLimitTransport) RoundTrip(req *http.Request) (*http.Response, error) {
ctx := req.Context()
req.Header.Set("X-Client-Secret", os.Getenv("WB_SECRET_TOKEN"))
req.Header.Set("User-Agent", "wbas_seller.denco.store3547")
tokenString := req.Header.Get("Authorization")
authData := utils.NewWbAuthData(tokenString)
authDataBytes, err := json.Marshal(authData)