joalla / discogs_client

Continuation of the "Official Python Client for the Discogs API"
https://python3-discogs-client.readthedocs.io
Other
299 stars 49 forks source link

requests need timeout #120

Closed aw-was-here closed 1 year ago

aw-was-here commented 1 year ago

For time-critical applications, it would be great if all of the request calls could use a provided timeout.

AnssiAhola commented 1 year ago

Hey @aw-was-here

Thanks for the feature request!

I don't have to time at the moment to look into this or implement it but would this feature look something like this

client.timeout(10) // 10 seconds

or maybe with separate connect and read timeouts?

client.connect_timeout(15)
client.read_timeout(10)
OR
client.timeout(connect=15, read=10)
aw-was-here commented 1 year ago

That's a great question. For the things I'm working on, total transaction time is important since it drives a live visual display and listener interaction. Delays are extremely noticeable so don't want to spend more than 3 seconds waiting for discogs to connect and give an answer. If the client can pipeline requests, then breaking it up into connect/read(or write?) timeout would make much more sense. Thanks!

AnssiAhola commented 1 year ago

Fyi this is now released! https://github.com/joalla/discogs_client/releases/tag/v2.6

aw-was-here commented 1 year ago

Awesome! Thanks!