Browse Source

feat: update to oban 2.0.0-rc3

tags/v0.71.0
Inhji Y. 1 month ago
parent
commit
fdcbf7aa58
14 changed files with 20 additions and 22 deletions
  1. +0
    -1
      apps/http/mix.exs
  2. +0
    -1
      apps/indie/mix.exs
  3. +3
    -3
      apps/listens/lib/listens/workers/discogs_album.ex
  4. +1
    -1
      apps/listens/lib/listens/workers/discogs_artist.ex
  5. +1
    -1
      apps/listens/lib/listens/workers/listenbrainz.ex
  6. +1
    -1
      apps/listens/mix.exs
  7. +3
    -2
      apps/tomie/lib/tomie/telemetry.ex
  8. +1
    -1
      apps/tomie/mix.exs
  9. +2
    -2
      apps/tomie_web/lib/tomie_web/live/job_live/queues.ex
  10. +3
    -3
      apps/tomie_web/lib/tomie_web/workers/bookmark_worker.ex
  11. +3
    -3
      apps/tomie_web/lib/tomie_web/workers/weather_worker.ex
  12. +1
    -1
      apps/tomie_web/mix.exs
  13. +0
    -1
      config/config.exs
  14. +1
    -1
      mix.lock

+ 0
- 1
apps/http/mix.exs View File

@@ -29,7 +29,6 @@ defmodule Http.MixProject do
{:cachex, "~> 3.2"},
{:floki, "~> 0.26.0"},
{:httpoison, "~> 1.6"},
{:oban, "~> 1.2"},
{:open_graph_extended, git: "https://git.inhji.de/inhji/open_graph.git"}
]
end


+ 0
- 1
apps/indie/mix.exs View File

@@ -27,7 +27,6 @@ defmodule Indie.MixProject do
[
{:bookmarks, in_umbrella: true},
{:http, in_umbrella: true},
{:oban, "~> 1.2"},
{:plug_micropub, "~> 0.1.0"},
{:webmentions, "~> 0.4.2"}
]


+ 3
- 3
apps/listens/lib/listens/workers/discogs_album.ex View File

@@ -17,7 +17,7 @@ defmodule Listens.Workers.DiscogsAlbum do
@rate_limit :rate_limit

@impl Oban.Worker
def perform(%{"action" => "fetch_cover"}, _job) do
def perform(%Oban.Job{args: %{"action" => "fetch_cover"}}) do
Albums.list_albums_without_cover(log: false)
|> Enum.each(&fetch_album_cover/1)

@@ -27,7 +27,7 @@ defmodule Listens.Workers.DiscogsAlbum do
:ok
end

def perform(%{"action" => "fetch_genres"}, _job) do
def perform(%Oban.Job{args: %{"action" => "fetch_genres"}}) do
Albums.list_albums_without_genres(log: false)
|> Enum.each(&fetch_album_genres_styles/1)

@@ -38,7 +38,7 @@ defmodule Listens.Workers.DiscogsAlbum do
end

@impl Oban.Worker
def perform(%{"action" => "search_id"}, _job) do
def perform(%Oban.Job{args: %{"action" => "search_id"}}) do
Albums.list_albums_without_discogs_id(log: false)
|> Enum.each(&search_discogs_id/1)



+ 1
- 1
apps/listens/lib/listens/workers/discogs_artist.ex View File

@@ -18,7 +18,7 @@ defmodule Listens.Workers.DiscogsArtist do
@rate_limit :rate_limit

@impl Oban.Worker
def perform(_args, _job) do
def perform(_job) do
Artists.list_artists_without_image(log: false)
|> Enum.each(&fetch_artist_image/1)



+ 1
- 1
apps/listens/lib/listens/workers/listenbrainz.ex View File

@@ -17,7 +17,7 @@ defmodule Listens.Workers.Listenbrainz do
@rate_limit :rate_limit

@impl Oban.Worker
def perform(%{"user" => user}, _job) do
def perform(%Oban.Job{args: %{"user" => user}}) do
count = Listens.Cache.try_get(@cache, @fetch_listen_count, @default_listen_count)
last_ts = Handler.last_listen_timestamp()
url = "#{@base_url}/#{user}/listens?min_ts=#{last_ts}&count=#{count}"


+ 1
- 1
apps/listens/mix.exs View File

@@ -30,7 +30,7 @@ defmodule Listens.MixProject do
{:db, in_umbrella: true},
{:ecto_sql, "~> 3.1"},
{:http, in_umbrella: true},
{:oban, "~> 1.2"},
{:oban, "2.0.0-rc.3"},
{:phoenix_pubsub, "~> 2.0"},
{:waffle, "~> 1.1"},
{:waffle_ecto, "~> 0.0.9"}


+ 3
- 2
apps/tomie/lib/tomie/telemetry.ex View File

@@ -39,8 +39,9 @@ defmodule Tomie.Telemetry do
summary("vm.total_run_queue_lengths.io"),

# Oban Metrics
summary("oban.success.duration", unit: {:native, :millisecond}),
summary("oban.failure.duration", unit: {:native, :millisecond})
summary("oban.job.start.duration", unit: {:native, :millisecond}),
summary("oban.job.stop.duration", unit: {:native, :millisecond}),
summary("oban.job.exception.duration", unit: {:native, :millisecond})
]
end



+ 1
- 1
apps/tomie/mix.exs View File

@@ -37,7 +37,7 @@ defmodule Tomie.MixProject do
# Type `mix help deps` for examples and options.
defp deps do
[
{:oban, "~> 1.2"},
{:oban, "2.0.0-rc.3"},
{:ecto_sql, "~> 3.1"},
{:jason, "~> 1.0"},
{:pow, "~> 1.0.19"},


+ 2
- 2
apps/tomie_web/lib/tomie_web/live/job_live/queues.ex View File

@@ -16,13 +16,13 @@ defmodule TomieWeb.JobLive.Queues do
end

def handle_event("pause_queue", %{"queue" => queue}, socket) do
:ok = Oban.pause_queue(queue)
:ok = Oban.pause_queue(queue: queue)

{:noreply, socket |> put_flash(:info, "Queue #{queue} paused!")}
end

def handle_event("resume_queue", %{"queue" => queue}, socket) do
:ok = Oban.resume_queue(queue)
:ok = Oban.resume_queue(queue: queue)

{:noreply, socket |> put_flash(:info, "Queue #{queue} resumed!")}
end


+ 3
- 3
apps/tomie_web/lib/tomie_web/workers/bookmark_worker.ex View File

@@ -1,12 +1,12 @@
defmodule TomieWeb.BookmarkWorker do
use Oban.Worker,
use Oban.Worker,
queue: :bookmarks,
max_attempts: 5

alias Bookmarks.Bookmark

@impl Oban.Worker
def perform(%{"id" => id, "url" => url}, _job) do
def perform(%Oban.Job{args: %{"id" => id, "url" => url}}) do
bookmark = Bookmarks.get_bookmark!(id)

with :ok <- scrape_bookmark_url(bookmark),
@@ -48,4 +48,4 @@ defmodule TomieWeb.BookmarkWorker do
{:error, message} -> {:error, message}
end
end
end
end

+ 3
- 3
apps/tomie_web/lib/tomie_web/workers/weather_worker.ex View File

@@ -1,12 +1,12 @@
defmodule TomieWeb.WeatherWorker do
use Oban.Worker,
use Oban.Worker,
queue: :scraper,
max_attempts: 1,
unique: [period: 60, fields: [:worker]]

@impl Oban.Worker
def perform(_args, _job) do
def perform(_job) do
Http.Weather.get_weather()
|> Http.Weather.save_weather()
end
end
end

+ 1
- 1
apps/tomie_web/mix.exs View File

@@ -47,7 +47,7 @@ defmodule TomieWeb.MixProject do
{:indie, in_umbrella: true},
{:jason, "~> 1.0"},
{:listens, in_umbrella: true},
{:oban, "~> 1.2.0"},
{:oban, "2.0.0-rc.3"},
{:phoenix, "~> 1.5.0"},
{:phoenix_active_link, "~> 0.3.0"},
{:phoenix_ecto, "~> 4.0"},


+ 0
- 1
config/config.exs View File

@@ -45,7 +45,6 @@ config :indie,

config :tomie, Oban,
repo: Db.Repo,
prune: {:maxlen, 10_000},
queues: [bookmarks: 10, listens: 10, scraper: 10, indie: 10],
crontab: [
{"* * * * *", Listens.Workers.Listenbrainz, args: %{user: "inhji"}},


+ 1
- 1
mix.lock View File

@@ -41,7 +41,7 @@
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
"mock": {:hex, :mock, "0.3.5", "feb81f52b8dcf0a0d65001d2fec459f6b6a8c22562d94a965862f6cc066b5431", [:mix], [{:meck, "~> 0.8.13", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "6fae404799408300f863550392635d8f7e3da6b71abdd5c393faf41b131c8728"},
"nimble_parsec": {:hex, :nimble_parsec, "0.6.0", "32111b3bf39137144abd7ba1cce0914533b2d16ef35e8abc5ec8be6122944263", [:mix], [], "hexpm", "27eac315a94909d4dc68bc07a4a83e06c8379237c5ea528a9acff4ca1c873c52"},
"oban": {:hex, :oban, "1.2.0", "7cca94d341be43d220571e28f69131c4afc21095b25257397f50973d3fc59b07", [:mix], [{:ecto_sql, "~> 3.1", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.14", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ba5f8b3f7d76967b3e23cf8014f6a13e4ccb33431e4808f036709a7f822362ee"},
"oban": {:hex, :oban, "2.0.0-rc.3", "964629fabc21939d7258a05a38f74b676bd4eebcf4932389e8ad9f1a18431bd2", [:mix], [{:ecto_sql, ">= 3.4.3", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.14", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "82c9688e066610a88776aac527022a320faed9b5918093061caf2767863cc3c5"},
"open_graph_extended": {:git, "https://git.inhji.de/inhji/open_graph.git", "bed84f89524ec5ba12ab85018ff6f166cfff7a3d", []},
"parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"},
"phoenix": {:hex, :phoenix, "1.5.3", "bfe0404e48ea03dfe17f141eff34e1e058a23f15f109885bbdcf62be303b49ff", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "8e16febeb9640d8b33895a691a56481464b82836d338bb3a23125cd7b6157c25"},


Loading…
Cancel
Save