-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Compatibility] Added CLIENT UNBLOCK command #886
base: main
Are you sure you want to change the base?
Changes from all commits
63ef1a4
1368fb1
398f6d2
6e0bb98
37db209
3ecb443
1748103
95e015e
6aeb1d2
747e026
8726cdd
af47a58
e18f24f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,17 @@ public class CollectionItemBroker : IDisposable | |
private bool disposed = false; | ||
private bool isStarted = false; | ||
|
||
/// <summary> | ||
/// Tries to get the observer associated with the given session ID. | ||
/// </summary> | ||
/// <param name="sessionId">The ID of the session to retrieve the observer for.</param> | ||
/// <param name="observer">When this method returns, contains the observer associated with the specified session ID, if the session ID is found; otherwise, null. This parameter is passed uninitialized.</param> | ||
/// <returns>true if the observer is found; otherwise, false.</returns> | ||
internal bool TryGetObserver(int sessionId, out CollectionItemObserver observer) | ||
TalZaccai marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
return SessionIdToObserver.TryGetValue(sessionId, out observer); | ||
} | ||
|
||
/// <summary> | ||
/// Asynchronously wait for item from collection object | ||
/// </summary> | ||
|
@@ -118,13 +129,15 @@ private async Task<CollectionItemResult> GetCollectionItemAsync(CollectionItemOb | |
? TimeSpan.FromMilliseconds(-1) | ||
: TimeSpan.FromSeconds(timeoutInSeconds); | ||
|
||
var isForceUnblocked = false; | ||
try | ||
{ | ||
// Wait for either the result found notification or the timeout to expire | ||
await observer.ResultFoundSemaphore.WaitAsync(timeout, observer.CancellationTokenSource.Token); | ||
} | ||
catch (OperationCanceledException) | ||
catch (OperationCanceledException) when (observer.CancellationTokenSource.IsCancellationRequested) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will also be true if the session was disposed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That should cause any issue right? earlier its just an empty catch, Now I am assigning a bool. Do you see any issue with that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, because if the session was disposed you wouldn't need to return a CollectionItemResult.Error |
||
{ | ||
isForceUnblocked = true; | ||
} | ||
|
||
SessionIdToObserver.TryRemove(observer.Session.ObjectStoreSessionID, out _); | ||
|
@@ -136,6 +149,11 @@ private async Task<CollectionItemResult> GetCollectionItemAsync(CollectionItemOb | |
observer.HandleSetResult(CollectionItemResult.Empty); | ||
} | ||
|
||
if (isForceUnblocked) | ||
{ | ||
return CollectionItemResult.Error; | ||
} | ||
|
||
return observer.Result; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here about running CommentInfoUpdater - #864 (comment)