Skip to content

Commit 6f78e48

Browse files
Apply suggestions from code review
Suggestions from @SteveSandersonMS Co-Authored-By: Steve Sanderson <[email protected]>
1 parent 695bb89 commit 6f78e48

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Components/Server/src/Circuits/RemoteRenderer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ internal class RemoteRenderer : HtmlRenderer
3030
private long _nextRenderId = 1;
3131
private bool _disposing = false;
3232
private bool _queueIsFullNotified;
33-
private ConcurrentQueue<UnacknowledgedRenderBatch> _unacknowledgedRenderBatches = new ConcurrentQueue<UnacknowledgedRenderBatch>();
33+
private readonly ConcurrentQueue<UnacknowledgedRenderBatch> _unacknowledgedRenderBatches = new ConcurrentQueue<UnacknowledgedRenderBatch>();
3434

3535
/// <summary>
3636
/// Notifies when a rendering exception occured.
@@ -92,11 +92,11 @@ protected override void ProcessRenderQueue()
9292
// If we got here it means we are at max capacity, so we don't want to actually process the queue,
9393
// as we have a client that is not acknowledging render batches fast enough (something we consider needs
9494
// to be fast).
95-
// The result is somethign as follows:
95+
// The result is something as follows:
9696
// Lets imagine an extreme case where the server produces a new batch every milisecond.
9797
// Lets say the client is able to ACK a batch every 100 miliseconds.
98-
// When the app starts the client might see the sequence 0.000->0.{MAXUnacknowledgeRenderBatches} and then
99-
// after 100 miliseconds it sees it jump to 0.1xx, then to 0.2xx where xx is something between {0..99} the
98+
// When the app starts the client might see the sequence 0->(MaxUnacknowledgedRenderBatches-1) and then
99+
// after 100 miliseconds it sees it jump to 1xx, then to 2xx where xx is something between {0..99} the
100100
// reason for this is that the server slows down rendering new batches to as fast as the client can consume
101101
// them.
102102
// Similarly, if a client were to send events at a faster pace than the server can consume them, the server
@@ -287,7 +287,7 @@ public void OnRenderCompleted(long incomingBatchId, string errorMessageOrNull)
287287
while (_unacknowledgedRenderBatches.TryPeek(out nextUnacknowledgedBatch) && nextUnacknowledgedBatch.BatchId <= incomingBatchId)
288288
{
289289
lastBatchId = nextUnacknowledgedBatch.BatchId;
290-
// At this point the queue is no longer full, we have at least emptied one slot, so we allow a further
290+
// At this point the queue is definitely not full, we have at least emptied one slot, so we allow a further
291291
// full queue log entry the next time it fills up.
292292
_queueIsFullNotified = false;
293293
_unacknowledgedRenderBatches.TryDequeue(out _);

0 commit comments

Comments
 (0)