Skip to content

Commit

Permalink
redirect to home if the stream dies out
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb committed May 7, 2024
1 parent eca872b commit 5345d82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/DrawTogether.Actors/Local/LocalDrawingSessionActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected override void PreStart()
{
AttemptToSubscribe();

Context.SetReceiveTimeout(TimeSpan.FromMinutes(15));
Context.SetReceiveTimeout(TimeSpan.FromMinutes(2));
var (sourceRef, source) = Source.ActorRef<AddPointToConnectedStroke>(1000, OverflowStrategy.DropHead)
.PreMaterialize(_materializer);

Expand Down
10 changes: 5 additions & 5 deletions src/DrawTogether/Components/Pages/Paint.razor
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<MudSlider Value="@_cursorSize.Value" ValueLabel="true" Min="1" Max="50" ValueChanged="@((int value) => UpdateCursorSize(value))">Cursor Size</MudSlider>
</MudPaper>
</MudStack>
</MudItem>
</MudItem>
<MudItem xs="10">
<section id="paint" style="background-color: cornsilk; width: 900px; height: 500px;"
@onmousemove="CursorMove" @onmousedown="CursorDown" @onmouseup="CursorUp">
Expand All @@ -47,9 +47,6 @@
</MudGrid>





<div id="active-users">
<ol>
@foreach (var u in ConnectedUsers)
Expand Down Expand Up @@ -138,6 +135,9 @@
while (!_shutdownCts.IsCancellationRequested && await _eventStream.WaitToReadAsync(_shutdownCts.Token))
while (_eventStream.TryRead(out var evt))
HandleEvent(evt);

// navigate us to home if the stream dies out
NavigationManager.NavigateTo("/");
}

private void HandleEvent(IDrawingSessionEvent item)
Expand Down Expand Up @@ -209,7 +209,7 @@
OnNext(new Point(e.OffsetX, e.OffsetY));
}
}

private void UpdateCursorSize(int cursorSize)
{
_cursorSize = new GreaterThanZeroInteger(cursorSize);
Expand Down

0 comments on commit 5345d82

Please sign in to comment.