Browse Source

fix: handle job duration for retryable jobs

master
Inhji Y. 10 months ago
parent
commit
4cb5f5644f
  1. 18
      apps/tomie_web/lib/tomie_web/views/job_view.ex

18
apps/tomie_web/lib/tomie_web/views/job_view.ex

@ -2,19 +2,13 @@ defmodule TomieWeb.JobView do
use TomieWeb, :view
alias TomieWeb.JobLive
def job_duration(%{state: "executing"} = _job) do
"Running"
end
def job_duration(%{state: "discarded"} = _job) do
"Discarded"
end
def job_duration(%{state: "available"} = _job) do
"Available"
end
def job_duration(%{state: "executing"} = _job), do: "Running"
def job_duration(%{state: "discarded"} = _job), do: "Discarded"
def job_duration(%{state: "available"} = _job), do: "Available"
def job_duration(%{state: "retryable"} = _job), do: "Retryable"
def job_duration(%{scheduled_at: scheduled_at, completed_at: completed_at} = job) do
IO.inspect(job)
def job_duration(%{scheduled_at: scheduled_at, completed_at: completed_at}) do
to_string(Timex.diff(completed_at, scheduled_at, :milliseconds)) <> "ms"
end

Loading…
Cancel
Save