Skip to content

Commit 61cd808

Browse files
Oleksandr Kolomiietschrisdunelm
Oleksandr Kolomiiets
authored andcommitted
PubSub: Avoid unobserved InvalidOperationException in AsyncSingleRecvQueue (#2785)
Fixes #2763
1 parent d5795f7 commit 61cd808

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎apis/Google.Cloud.PubSub.V1/Google.Cloud.PubSub.V1/SubscriberClient.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,9 @@ public void Enqueue(T item)
659659
}
660660
if (tcs != null)
661661
{
662-
// Don't run in lock, as it may execute continuations synchonously.
663-
tcs.SetResult(0);
662+
// Don't run in lock, as it may execute continuations synchronously.
663+
// Use TrySetResult as this can be called multiple times on the same tcs instance
664+
tcs.TrySetResult(0);
664665
}
665666
}
666667

0 commit comments

Comments
 (0)