Skip to content

Timeout exceeded #508

Description

@nathanhack

Describe the bug
https://github.com/polygon-io/client-go/blob/fb8e9d4845ca5e86e464919e4e864efa62e06304/rest/client/client.go#L48
The timout is set too low for queries like the following:
https://api.polygon.io/v3/reference/options/contracts?underlying_ticker=QQQ&expired=true&limit=1000

Results in this error being printed to the screen:

 WARN RESTY Get .... context deadline exceeded (Client.Timeout exceeded while awaiting headers)

After several attempts it fails out with:

 failed to execute request: Get "https://api.polygon.io/v3/reference/options/contracts?expired=true&limit=1000&underlying_ticker=QQQ": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

To Reproduce

params := models.ListOptionsContractsParams{}.
			WithExpired(expired).
			WithLimit(1000).
			WithUnderlyingTicker("QQQ")

iter := client.ReferenceClient.ListOptionsContracts(context.Background(), params)
items := make([]models.OptionsContract, 500_000)
for iter.Next() {
       items = append(items, iter.Item())
}

Additional context

After increasing from 10 seconds to 60 seconds there are no errors are printed to the screen and it successfully downloads the contracts. This also occurs when I use the option quotes endpoint as well. This issue is a problem across multiple endpoints using the golang lib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions