Context timeout ignored in Watermill's Google PubSub publisher due to premature Ready()
blocking
#562
Labels
bug
Something isn't working
Content-Length: 218445 | pFad | http://github.com/ThreeDotsLabs/watermill/issues/562
9CReady()
blocking
#562
Fetched URL: http://github.com/ThreeDotsLabs/watermill/issues/562
Alternative Proxies:
Steps to reproduce
Expected behavior
Actual behavior
Possible solution
The root cause lies in the following lines:
https://github.com/ThreeDotsLabs/watermill-googlecloud/blob/4a22a44b6cdbe7c270cb1e0fc3355f97141645ee/pkg/googlecloud/publisher.go#L166C1-L169C42
We're blocking on
<-result.Ready()
before callingGet(ctx)
. According to the Get implementation in the Google Cloud Pub/Sub client:Since we're explicitly waiting on
Ready()
before callingGet
, the context is essentially ignored, andGet(ctx)
will always return the result, regardless of context timeout.A potential fix is to remove the
<-result.Ready()
line, allowingGet(ctx)
to handle bothReady
and respecting the context deadline.The text was updated successfully, but these errors were encountered: