@@ -2,6 +2,7 @@ package main
22
33import (
44 "context"
5+ "crypto/tls"
56 "flag"
67 "fmt"
78 "github.com/erply/api-go-wrapper/pkg/api"
@@ -18,12 +19,20 @@ func main() {
1819 clientCode := flag .String ("cc" , "" , "client code" )
1920 flag .Parse ()
2021
22+ connectionTimeout := 60 * time .Second
23+ transport := & http.Transport {
24+ DisableKeepAlives : true ,
25+ TLSClientConfig : & tls.Config {InsecureSkipVerify : true },
26+ ResponseHeaderTimeout : connectionTimeout ,
27+ }
28+ httpCl := & http.Client {Transport : transport }
29+
2130 sessionKey , err := auth .VerifyUser (* username , * password , * clientCode , http .DefaultClient )
2231 if err != nil {
2332 panic (err )
2433 }
2534
26- apiClient , err := api .NewClient (sessionKey , * clientCode , nil )
35+ apiClient , err := api .NewClient (sessionKey , * clientCode , httpCl )
2736 if err != nil {
2837 panic (err )
2938 }
@@ -80,8 +89,8 @@ func GetProductsInParallel(cl *api.Client) ([]products.Product, error) {
8089 sharedCommon.ListingSettings {
8190 MaxRequestsCountPerSecond : 5 ,
8291 StreamBufferLength : 10 ,
83- MaxItemsPerRequest : 10 ,
84- MaxFetchersCount : 2 ,
92+ MaxItemsPerRequest : 300 ,
93+ MaxFetchersCount : 10 ,
8594 },
8695 productsDataProvider ,
8796 func (sleepTime time.Duration ) {
@@ -92,7 +101,9 @@ func GetProductsInParallel(cl *api.Client) ([]products.Product, error) {
92101 ctx , cancel := context .WithTimeout (context .Background (), time .Second * 5 )
93102 defer cancel ()
94103
95- prodsChan := lister .Get (ctx , map [string ]interface {}{})
104+ prodsChan := lister .Get (ctx , map [string ]interface {}{
105+ "changedSince" : time .Date (2020 , 2 , 15 , 0 , 0 , 0 , 0 , time .UTC ).Unix (),
106+ })
96107
97108 prods := make ([]products.Product , 0 )
98109 var err error
0 commit comments