You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/lib/asciinema/asciicasts/snapshot_updater/exq.ex

16 lines
415 B
Elixir

defmodule Asciinema.Asciicasts.SnapshotUpdater.Exq do
alias Asciinema.{Repo, Asciicasts}
alias Asciinema.Asciicasts.Asciicast
def update_snapshot(%Asciicast{id: id}) do
{:ok, _jid} = Exq.enqueue(Exq, "default", __MODULE__, [id])
:ok
end
def perform(asciicast_id) do
if asciicast = Repo.get(Asciicast, asciicast_id) do
{:ok, _} = Asciicasts.update_snapshot(asciicast)
end
end
end