Skip to content

Commit

Permalink
Remove client rate limit code
Browse files Browse the repository at this point in the history
  • Loading branch information
0xblockhash committed Jul 13, 2023
1 parent 7a072ed commit 4c77e2a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions common/httpconn/httpconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ func newDefaultRateLimiter() *rate.Limiter {

func NewHttpConn(rpcUrl string) *HttpConn {
return &HttpConn{
c: &http.Client{},
rl: newDefaultRateLimiter(),
c: &http.Client{},
// rl: newDefaultRateLimiter(),
rpcUrl: rpcUrl,
timeout: defaultTimeout,
}
}

func NewCustomHttpConn(rpcUrl string, cli *http.Client) *HttpConn {
return &HttpConn{
c: cli,
rl: newDefaultRateLimiter(),
c: cli,
// rl: newDefaultRateLimiter(),
rpcUrl: rpcUrl,
timeout: defaultTimeout,
}
Expand All @@ -56,10 +56,10 @@ func (h *HttpConn) Request(ctx context.Context, op Operation) ([]byte, error) {
return []byte{}, err
}

err = h.rl.Wait(ctx) // This is a blocking call. Honors the rate limit.
if err != nil {
return nil, err
}
// err = h.rl.Wait(ctx) // This is a blocking call. Honors the rate limit.
// if err != nil {
// return nil, err
// }

request, err := http.NewRequest("POST", h.rpcUrl, bytes.NewBuffer(reqBytes))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion examples/object/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func SuiXGetOwnedObjects() {

func SuiMultiGetObjects() {
rsp, err := cli.SuiMultiGetObjects(ctx, models.SuiMultiGetObjectsRequest{
ObjectIds: []string{"0xb1c9e223b3a49cbb9365abe88a6da5464d9d88aa5176913536f4dacdba390570"},
ObjectIds: []string{"0x02b547f6aaece97b39142093205d5802101599833c65334ec3beb0aeed82c884"},
Options: models.SuiObjectDataOptions{
ShowContent: true,
ShowDisplay: true,
Expand Down

0 comments on commit 4c77e2a

Please sign in to comment.