Skip to content

Commit

Permalink
fix Renderable.ensure() not always returning correct type
Browse files Browse the repository at this point in the history
  • Loading branch information
breunigs committed Jul 22, 2024
1 parent 9ccc01a commit 533ad55
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/basemap/renderable.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ defmodule Basemap.Renderable do
def path(:cache, extra), do: Path.join("data/cache/basemap/#{name()}", extra)
def path(:container, extra), do: Path.join("/workdir/basemap/#{name()}", extra)

@spec ensure() :: :ok | {:error, reason :: binary()}
def ensure() do
ident = "basemap #{name()}"
{stale, reason} = Benchmark.measure("#{ident} staleness check", &staleness/0)

if stale do
Logger.info("#{ident} is stale because #{reason}")
Benchmark.measure("#{ident} rendering", &render/0)
end
end || :ok
end

@impl Basemap.Renderable
Expand Down

0 comments on commit 533ad55

Please sign in to comment.