Skip to content

Commit

Permalink
Fix LiveStreamServer crash when reset doesn't come quick enough after…
Browse files Browse the repository at this point in the history
… init
  • Loading branch information
ku1ik committed Apr 6, 2024
1 parent c369244 commit d73c83c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/asciinema/streaming/live_stream_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,19 @@ defmodule Asciinema.Streaming.LiveStreamServer do

def handle_info(:update_stream, state) do
Process.send_after(self(), :update_stream, @update_stream_interval)
{cols, rows} = state.vt_size

stream =
Streaming.update_live_stream(state.stream,
current_viewer_count: state.viewer_count,
cols: cols,
rows: rows
)
case state.vt_size do
{cols, rows} ->
Streaming.update_live_stream(state.stream,
current_viewer_count: state.viewer_count,
cols: cols,
rows: rows
)

nil ->
state.stream
end

{:noreply, %{state | stream: stream}}
end
Expand Down

0 comments on commit d73c83c

Please sign in to comment.