nsqio / go-nsq

The official Go package for NSQ
MIT License
2.59k stars 444 forks source link

*: context.Context and timeouts #360

Open jehiah opened 9 months ago

jehiah commented 9 months ago

Go 1.7 added context.Context and it's been widely adopted for providing a way to control timeouts.

This ticket is to track adding context.Context to go-nsq in a way that provides control over connections so the caller can avoid unexpected long operations (like a TCP dial timeout when trying to Publish)

This replaces #210 and #211 and along with #311 provide more reliable publishing in some edge cases.

At Bitly we have an interest in pursuing this change - we will follow up with a specific proposal with a mind to implementing in a backwards compatible way, and with a look towards easy transition to a future v2 that might drop calls w/o a context. We also want to be identify any changes needed in the design of #311 ahead of time before that change lands.

cc: @mreiferson @ploxiln @zoemccormick @Ulminator