-
Notifications
You must be signed in to change notification settings - Fork 165
Closed
Labels
needs investigationThe described problem requires additional time to studyThe described problem requires additional time to study
Description
When generating subscription messages in rapid succession, some messages may never make it back to the client. I've debugged the issue to the Subscription.OnNext function calling _writer.Post here:
| _writer.Post(new OperationMessage |
The call to _writer.Post returns false when the messages are lost. A false return value is meant to indicate that the Post could not be completed without blocking, but the Subscription.OnNext function does not handle this case.
My solution is to use _write.SendAsync instead, as it will send the messages even if it must block. Here are my implementation of Subscription.OnNext:
public void OnNext(ExecutionResult value)
{
_logger.LogDebug("Subscription: {subscriptionId} got data", Id);
var task = Task.Run(() => _writer.SendAsync(new OperationMessage
{
Type = MessageType.GQL_DATA,
Id = Id,
Payload = value
}));
task.Wait();
}
I am not sure if this is the best solution, but it is working for my use case.
Metadata
Metadata
Assignees
Labels
needs investigationThe described problem requires additional time to studyThe described problem requires additional time to study