Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Unified Diff: common/gcloud/pubsub/subscriber/subscriber.go

Issue 1679023005: Add Context cancellation to clock. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Actually upload the patch. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/gcloud/pubsub/ackbuffer/ackbuffer_test.go ('k') | common/meter/config.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/gcloud/pubsub/subscriber/subscriber.go
diff --git a/common/gcloud/pubsub/subscriber/subscriber.go b/common/gcloud/pubsub/subscriber/subscriber.go
index 53300d8594ceb362a786edaf8bfdb0e3869dcb76..bdefe9d11238e5287ca5eb74da5787187b765f70 100644
--- a/common/gcloud/pubsub/subscriber/subscriber.go
+++ b/common/gcloud/pubsub/subscriber/subscriber.go
@@ -164,18 +164,5 @@ func (s *Subscriber) noDataSleep(c context.Context) {
if d <= 0 {
d = DefaultNoDataDelay
}
- cancellableSleep(c, d)
-}
-
-// cancellableSleep sleeps, returning either when the sleep duration has expired
-// or the supplied context has been canceled.
-func cancellableSleep(c context.Context, delay time.Duration) {
- // Sleep for "delay", stopping early if our Context is canceled.
- select {
- case <-clock.After(c, delay):
- break
-
- case <-c.Done():
- break
- }
+ clock.Sleep(c, d)
}
« no previous file with comments | « common/gcloud/pubsub/ackbuffer/ackbuffer_test.go ('k') | common/meter/config.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698