fix: propagation overlay broken by iolist→binary crash in encode_binary
Two regressions from the recent performance commits: 1. ScoresController.encode_binary/1 (9cce257d): Enum.reduce produces iolists, but <<lats::binary>> requires actual binaries. Caused HTTP 500 on every /scores/cells request when score files exist on disk, making the entire propagation heatmap overlay invisible. 2. ScoreCache.valid_times/1 (15f4175c): Pipe syntax feeds @table as the first argument to :ets.foldl/3, creating a 4-argument call that crashes at runtime.
This commit is contained in:
parent
e8b143813e
commit
ec1529fa6b
2 changed files with 3 additions and 3 deletions
|
|
@ -149,8 +149,7 @@ defmodule Microwaveprop.Propagation.ScoreCache do
|
||||||
@doc "Returns the sorted list of valid_times cached for `band_mhz`."
|
@doc "Returns the sorted list of valid_times cached for `band_mhz`."
|
||||||
@spec valid_times(non_neg_integer()) :: [DateTime.t()]
|
@spec valid_times(non_neg_integer()) :: [DateTime.t()]
|
||||||
def valid_times(band_mhz) do
|
def valid_times(band_mhz) do
|
||||||
@table
|
:ets.foldl(
|
||||||
|> :ets.foldl(
|
|
||||||
fn
|
fn
|
||||||
{{^band_mhz, vt}, _}, acc -> [vt | acc]
|
{{^band_mhz, vt}, _}, acc -> [vt | acc]
|
||||||
_, acc -> acc
|
_, acc -> acc
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,8 @@ defmodule MicrowavepropWeb.ScoresController do
|
||||||
[<<clamp_score(s.score)::8>> | scs_acc]}
|
[<<clamp_score(s.score)::8>> | scs_acc]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
<<header::binary, lats::binary, lons::binary, score_bytes::binary>>
|
<<header::binary, IO.iodata_to_binary(lats)::binary,
|
||||||
|
IO.iodata_to_binary(lons)::binary, IO.iodata_to_binary(score_bytes)::binary>>
|
||||||
end
|
end
|
||||||
|
|
||||||
defp clamp_score(s) when is_integer(s) and s < 0, do: 0
|
defp clamp_score(s) when is_integer(s) and s < 0, do: 0
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue