@@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"context"
5
+ "crypto/tls"
5
6
"flag"
6
7
"fmt"
7
8
"github.com/erply/api-go-wrapper/pkg/api"
@@ -18,12 +19,20 @@ func main() {
18
19
clientCode := flag .String ("cc" , "" , "client code" )
19
20
flag .Parse ()
20
21
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
+
21
30
sessionKey , err := auth .VerifyUser (* username , * password , * clientCode , http .DefaultClient )
22
31
if err != nil {
23
32
panic (err )
24
33
}
25
34
26
- apiClient , err := api .NewClient (sessionKey , * clientCode , nil )
35
+ apiClient , err := api .NewClient (sessionKey , * clientCode , httpCl )
27
36
if err != nil {
28
37
panic (err )
29
38
}
@@ -80,8 +89,8 @@ func GetProductsInParallel(cl *api.Client) ([]products.Product, error) {
80
89
sharedCommon.ListingSettings {
81
90
MaxRequestsCountPerSecond : 5 ,
82
91
StreamBufferLength : 10 ,
83
- MaxItemsPerRequest : 10 ,
84
- MaxFetchersCount : 2 ,
92
+ MaxItemsPerRequest : 300 ,
93
+ MaxFetchersCount : 10 ,
85
94
},
86
95
productsDataProvider ,
87
96
func (sleepTime time.Duration ) {
@@ -92,7 +101,9 @@ func GetProductsInParallel(cl *api.Client) ([]products.Product, error) {
92
101
ctx , cancel := context .WithTimeout (context .Background (), time .Second * 5 )
93
102
defer cancel ()
94
103
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
+ })
96
107
97
108
prods := make ([]products.Product , 0 )
98
109
var err error
0 commit comments