migrate to oban 2.0-rc1
authorMaksim Pechnikov <parallel588@gmail.com>
Tue, 23 Jun 2020 12:09:01 +0000 (15:09 +0300)
committerMaksim Pechnikov <parallel588@gmail.com>
Tue, 23 Jun 2020 12:09:01 +0000 (15:09 +0300)
28 files changed:
config/config.exs
config/test.exs
lib/pleroma/application.ex
lib/pleroma/workers/attachments_cleanup_worker.ex
lib/pleroma/workers/background_worker.ex
lib/pleroma/workers/cron/clear_oauth_token_worker.ex
lib/pleroma/workers/cron/digest_emails_worker.ex
lib/pleroma/workers/cron/new_users_digest_worker.ex
lib/pleroma/workers/cron/purge_expired_activities_worker.ex
lib/pleroma/workers/cron/stats_worker.ex
lib/pleroma/workers/mailer_worker.ex
lib/pleroma/workers/publisher_worker.ex
lib/pleroma/workers/receiver_worker.ex
lib/pleroma/workers/remote_fetcher_worker.ex
lib/pleroma/workers/scheduled_activity_worker.ex
lib/pleroma/workers/transmogrifier_worker.ex
lib/pleroma/workers/web_pusher_worker.ex
lib/pleroma/workers/worker_helper.ex
mix.exs
mix.lock
test/activity_expiration_test.exs
test/support/oban_helpers.ex
test/web/activity_pub/activity_pub_test.exs
test/workers/cron/clear_oauth_token_worker_test.exs
test/workers/cron/digest_emails_worker_test.exs
test/workers/cron/new_users_digest_worker_test.exs
test/workers/cron/purge_expired_activities_worker_test.exs
test/workers/scheduled_activity_worker_test.exs

index e0888fa9a49555f62eb712ba41ba8f189c215340..dcf4291d6ca2b9d47cccc3982a34afdfae573de6 100644 (file)
@@ -494,8 +494,7 @@ config :pleroma, Pleroma.User,
 
 config :pleroma, Oban,
   repo: Pleroma.Repo,
-  verbose: false,
-  prune: {:maxlen, 1500},
+  log: false,
   queues: [
     activity_expiration: 10,
     federator_incoming: 50,
index e38b9967d67a387031ad58d0b50b22458d45fd54..054fac3559bc50e3d6b2be8ea9d24320fe798fae 100644 (file)
@@ -79,8 +79,8 @@ config :web_push_encryption, :http_client, Pleroma.Web.WebPushHttpClientMock
 
 config :pleroma, Oban,
   queues: false,
-  prune: :disabled,
-  crontab: false
+  crontab: false,
+  plugins: false
 
 config :pleroma, Pleroma.ScheduledActivity,
   daily_user_limit: 2,
index 9615af1229a9541bac56506a19ba63f5e59bd23a..fb2731f97d910c5021ada0af32d22e0017c248cc 100644 (file)
@@ -80,7 +80,7 @@ defmodule Pleroma.Application do
         [
           Pleroma.Stats,
           Pleroma.JobQueueMonitor,
-          {Oban, Config.get(Oban)}
+          {Oban, oban_config()}
         ] ++
         task_children(@env) ++
         streamer_child(@env) ++
@@ -138,6 +138,18 @@ defmodule Pleroma.Application do
     Pleroma.Web.Endpoint.Instrumenter.setup()
   end
 
+  defp oban_config do
+    config = Config.get(Oban)
+
+    if Code.ensure_loaded?(IEx) and IEx.started?() do
+      config
+      |> Keyword.put(:crontab, false)
+      |> Keyword.put(:queues, false)
+    else
+      config
+    end
+  end
+
   defp cachex_children do
     [
       build_cachex("used_captcha", ttl_interval: seconds_valid_interval()),
index 8deeabda09ae6f6e31df6d7882792f452239a49f..58226b395ef21501284bbe162dae307028ca4933 100644 (file)
@@ -11,13 +11,12 @@ defmodule Pleroma.Workers.AttachmentsCleanupWorker do
   use Pleroma.Workers.WorkerHelper, queue: "attachments_cleanup"
 
   @impl Oban.Worker
-  def perform(
-        %{
+  def perform(%Job{
+        args: %{
           "op" => "cleanup_attachments",
           "object" => %{"data" => %{"attachment" => [_ | _] = attachments, "actor" => actor}}
-        },
-        _job
-      ) do
+        }
+      }) do
     attachments
     |> Enum.flat_map(fn item -> Enum.map(item["url"], & &1["href"]) end)
     |> fetch_objects
@@ -28,7 +27,7 @@ defmodule Pleroma.Workers.AttachmentsCleanupWorker do
     {:ok, :success}
   end
 
-  def perform(%{"op" => "cleanup_attachments", "object" => _object}, _job), do: {:ok, :skip}
+  def perform(%Job{args: %{"op" => "cleanup_attachments", "object" => _object}}), do: {:ok, :skip}
 
   defp do_clean({object_ids, attachment_urls}) do
     uploader = Pleroma.Config.get([Pleroma.Upload, :uploader])
index 57c3a9c3a30c9209683362b4d730523fefc75202..cec5a746294499f248f51980c1f10d681e0b10bf 100644 (file)
@@ -11,59 +11,59 @@ defmodule Pleroma.Workers.BackgroundWorker do
 
   @impl Oban.Worker
 
-  def perform(%{"op" => "deactivate_user", "user_id" => user_id, "status" => status}, _job) do
+  def perform(%Job{args: %{"op" => "deactivate_user", "user_id" => user_id, "status" => status}}) do
     user = User.get_cached_by_id(user_id)
     User.perform(:deactivate_async, user, status)
   end
 
-  def perform(%{"op" => "delete_user", "user_id" => user_id}, _job) do
+  def perform(%Job{args: %{"op" => "delete_user", "user_id" => user_id}}) do
     user = User.get_cached_by_id(user_id)
     User.perform(:delete, user)
   end
 
-  def perform(%{"op" => "force_password_reset", "user_id" => user_id}, _job) do
+  def perform(%Job{args: %{"op" => "force_password_reset", "user_id" => user_id}}) do
     user = User.get_cached_by_id(user_id)
     User.perform(:force_password_reset, user)
   end
 
-  def perform(
-        %{
+  def perform(%Job{
+        args: %{
           "op" => "blocks_import",
           "blocker_id" => blocker_id,
           "blocked_identifiers" => blocked_identifiers
-        },
-        _job
-      ) do
+        }
+      }) do
     blocker = User.get_cached_by_id(blocker_id)
     {:ok, User.perform(:blocks_import, blocker, blocked_identifiers)}
   end
 
-  def perform(
-        %{
+  def perform(%Job{
+        args: %{
           "op" => "follow_import",
           "follower_id" => follower_id,
           "followed_identifiers" => followed_identifiers
-        },
-        _job
-      ) do
+        }
+      }) do
     follower = User.get_cached_by_id(follower_id)
     {:ok, User.perform(:follow_import, follower, followed_identifiers)}
   end
 
-  def perform(%{"op" => "media_proxy_preload", "message" => message}, _job) do
+  def perform(%Job{args: %{"op" => "media_proxy_preload", "message" => message}}) do
     MediaProxyWarmingPolicy.perform(:preload, message)
   end
 
-  def perform(%{"op" => "media_proxy_prefetch", "url" => url}, _job) do
+  def perform(%Job{args: %{"op" => "media_proxy_prefetch", "url" => url}}) do
     MediaProxyWarmingPolicy.perform(:prefetch, url)
   end
 
-  def perform(%{"op" => "fetch_data_for_activity", "activity_id" => activity_id}, _job) do
+  def perform(%Job{args: %{"op" => "fetch_data_for_activity", "activity_id" => activity_id}}) do
     activity = Activity.get_by_id(activity_id)
     Pleroma.Web.RichMedia.Helpers.perform(:fetch, activity)
   end
 
-  def perform(%{"op" => "move_following", "origin_id" => origin_id, "target_id" => target_id}, _) do
+  def perform(%Job{
+        args: %{"op" => "move_following", "origin_id" => origin_id, "target_id" => target_id}
+      }) do
     origin = User.get_cached_by_id(origin_id)
     target = User.get_cached_by_id(target_id)
 
index a4c3b9516a0a7e54a9d0177b3b077c9c37e0a564..d41be4e87be28b19c1306b1bc349da51340368dd 100644 (file)
@@ -13,7 +13,7 @@ defmodule Pleroma.Workers.Cron.ClearOauthTokenWorker do
   alias Pleroma.Web.OAuth.Token
 
   @impl Oban.Worker
-  def perform(_opts, _job) do
+  def perform(_job) do
     if Config.get([:oauth2, :clean_expired_tokens], false) do
       Token.delete_expired_tokens()
     else
index 7f09ff3cf56a05ca043732e9ae333bb25c2c0115..ee646229f22a727f538e427f89a305e224bab1cf 100644 (file)
@@ -19,7 +19,7 @@ defmodule Pleroma.Workers.Cron.DigestEmailsWorker do
   require Logger
 
   @impl Oban.Worker
-  def perform(_opts, _job) do
+  def perform(_job) do
     config = Config.get([:email_notifications, :digest])
 
     if config[:active] do
index 5c816b3fe3568aee3e67f1f1bd72dc454f917505..abc8a5e954f066567a7e190f1c4bef4b90b8c061 100644 (file)
@@ -12,7 +12,7 @@ defmodule Pleroma.Workers.Cron.NewUsersDigestWorker do
   use Pleroma.Workers.WorkerHelper, queue: "new_users_digest"
 
   @impl Oban.Worker
-  def perform(_args, _job) do
+  def perform(_job) do
     if Pleroma.Config.get([Pleroma.Emails.NewUsersDigestEmail, :enabled]) do
       today = NaiveDateTime.utc_now() |> Timex.beginning_of_day()
 
index 84b3b84dea00d87a48d19d9d00fb073d28bfa593..e926c5dc8e68a5624bf11d5cfdb165ff7eddef13 100644 (file)
@@ -20,7 +20,7 @@ defmodule Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker do
   @interval :timer.minutes(1)
 
   @impl Oban.Worker
-  def perform(_opts, _job) do
+  def perform(_job) do
     if Config.get([ActivityExpiration, :enabled]) do
       Enum.each(ActivityExpiration.due_expirations(@interval), &delete_activity/1)
     else
index e9b8d59c446379ea27de31fcaf2e81209a6671dc..e54bd9a7fc9700ae5dd73bb850f805bc9433d593 100644 (file)
@@ -10,7 +10,7 @@ defmodule Pleroma.Workers.Cron.StatsWorker do
   use Oban.Worker, queue: "background"
 
   @impl Oban.Worker
-  def perform(_opts, _job) do
+  def perform(_job) do
     Pleroma.Stats.do_collect()
   end
 end
index 6955338a5014bcfc7168a58c4a19617fc17c5296..32273cfa55ea5a6382d958a92e8ceb993733c846 100644 (file)
@@ -6,7 +6,7 @@ defmodule Pleroma.Workers.MailerWorker do
   use Pleroma.Workers.WorkerHelper, queue: "mailer"
 
   @impl Oban.Worker
-  def perform(%{"op" => "email", "encoded_email" => encoded_email, "config" => config}, _job) do
+  def perform(%Job{args: %{"op" => "email", "encoded_email" => encoded_email, "config" => config}}) do
     encoded_email
     |> Base.decode64!()
     |> :erlang.binary_to_term()
index daf79efc04a0eb3cf9c1457620643cb3a0fbfdf6..e739c3cd0afac877a37966b243385944cbe1e0e8 100644 (file)
@@ -8,17 +8,17 @@ defmodule Pleroma.Workers.PublisherWorker do
 
   use Pleroma.Workers.WorkerHelper, queue: "federator_outgoing"
 
-  def backoff(attempt) when is_integer(attempt) do
+  def backoff(%Job{attempt: attempt}) when is_integer(attempt) do
     Pleroma.Workers.WorkerHelper.sidekiq_backoff(attempt, 5)
   end
 
   @impl Oban.Worker
-  def perform(%{"op" => "publish", "activity_id" => activity_id}, _job) do
+  def perform(%Job{args: %{"op" => "publish", "activity_id" => activity_id}}) do
     activity = Activity.get_by_id(activity_id)
     Federator.perform(:publish, activity)
   end
 
-  def perform(%{"op" => "publish_one", "module" => module_name, "params" => params}, _job) do
+  def perform(%Job{args: %{"op" => "publish_one", "module" => module_name, "params" => params}}) do
     params = Map.new(params, fn {k, v} -> {String.to_atom(k), v} end)
     Federator.perform(:publish_one, String.to_atom(module_name), params)
   end
index f7a7124f39c98afcbd1572c17274557374e3c459..1b97af1a8ea8af3973428cbeb29dc2aed2ec853b 100644 (file)
@@ -8,7 +8,7 @@ defmodule Pleroma.Workers.ReceiverWorker do
   use Pleroma.Workers.WorkerHelper, queue: "federator_incoming"
 
   @impl Oban.Worker
-  def perform(%{"op" => "incoming_ap_doc", "params" => params}, _job) do
+  def perform(%Job{args: %{"op" => "incoming_ap_doc", "params" => params}}) do
     Federator.perform(:incoming_ap_doc, params)
   end
 end
index ec6534f219ff8a8113aa1ecc769b662cd9b8328a..27e2e3386cec56a3f46cb7aea4f2cc04c3d086bd 100644 (file)
@@ -8,13 +8,7 @@ defmodule Pleroma.Workers.RemoteFetcherWorker do
   use Pleroma.Workers.WorkerHelper, queue: "remote_fetcher"
 
   @impl Oban.Worker
-  def perform(
-        %{
-          "op" => "fetch_remote",
-          "id" => id
-        } = args,
-        _job
-      ) do
+  def perform(%Job{args: %{"op" => "fetch_remote", "id" => id} = args}) do
     {:ok, _object} = Fetcher.fetch_object_from_id(id, depth: args["depth"])
   end
 end
index 97d1efbfbd8d70cd1110bc1072a5fa11473dd2df..dd9986fe4345747749847be96f4eb0ce64576a68 100644 (file)
@@ -17,7 +17,7 @@ defmodule Pleroma.Workers.ScheduledActivityWorker do
   require Logger
 
   @impl Oban.Worker
-  def perform(%{"activity_id" => activity_id}, _job) do
+  def perform(%Job{args: %{"activity_id" => activity_id}}) do
     if Config.get([ScheduledActivity, :enabled]) do
       case Pleroma.Repo.get(ScheduledActivity, activity_id) do
         %ScheduledActivity{} = scheduled_activity ->
index 11239ca5e68f4283e502c72f39f4fe8a6af6734f..15f36375c23c522af79715717c9ac3e80268f09a 100644 (file)
@@ -8,7 +8,7 @@ defmodule Pleroma.Workers.TransmogrifierWorker do
   use Pleroma.Workers.WorkerHelper, queue: "transmogrifier"
 
   @impl Oban.Worker
-  def perform(%{"op" => "user_upgrade", "user_id" => user_id}, _job) do
+  def perform(%Job{args: %{"op" => "user_upgrade", "user_id" => user_id}}) do
     user = User.get_cached_by_id(user_id)
     Pleroma.Web.ActivityPub.Transmogrifier.perform(:user_upgrade, user)
   end
index 58ad25e399199d957b74e23bfba70d1efacadfdd..0cfdc6a6f80ddea9e996bf02bce4044563f174ce 100644 (file)
@@ -9,7 +9,7 @@ defmodule Pleroma.Workers.WebPusherWorker do
   use Pleroma.Workers.WorkerHelper, queue: "web_push"
 
   @impl Oban.Worker
-  def perform(%{"op" => "web_push", "notification_id" => notification_id}, _job) do
+  def perform(%Job{args: %{"op" => "web_push", "notification_id" => notification_id}}) do
     notification =
       Notification
       |> Repo.get(notification_id)
index d1f90c35beb13d36d1a6684556249cddeb4c056a..7d1289be29fea183ff17020a3dee52ef1f2fd062 100644 (file)
@@ -32,6 +32,8 @@ defmodule Pleroma.Workers.WorkerHelper do
         queue: unquote(queue),
         max_attempts: 1
 
+      alias Oban.Job
+
       def enqueue(op, params, worker_args \\ []) do
         params = Map.merge(%{"op" => op}, params)
         queue_atom = String.to_atom(unquote(queue))
@@ -39,7 +41,7 @@ defmodule Pleroma.Workers.WorkerHelper do
 
         unquote(caller_module)
         |> apply(:new, [params, worker_args])
-        |> Pleroma.Repo.insert()
+        |> Oban.insert()
       end
     end
   end
diff --git a/mix.exs b/mix.exs
index 4d13e95d7195f3f7548f670d5ca4b0396b2ba946..e93dc7753eed938aae540577cf384a04e8bb88a7 100644 (file)
--- a/mix.exs
+++ b/mix.exs
@@ -124,7 +124,7 @@ defmodule Pleroma.Mixfile do
       {:ecto_enum, "~> 1.4"},
       {:ecto_sql, "~> 3.3.2"},
       {:postgrex, ">= 0.13.5"},
-      {:oban, "~> 1.2"},
+      {:oban, "~> 2.0.0-rc.1"},
       {:gettext, "~> 0.15"},
       {:pbkdf2_elixir, "~> 1.0"},
       {:bcrypt_elixir, "~> 2.0"},
index 5383c2c6ed5ae3b7d5645a83e8aeb949700b93c9..705e911f8657483b1098f902387dfe520eb6818b 100644 (file)
--- a/mix.lock
+++ b/mix.lock
   "crontab": {:hex, :crontab, "1.1.8", "2ce0e74777dfcadb28a1debbea707e58b879e6aa0ffbf9c9bb540887bce43617", [:mix], [{:ecto, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"},
   "crypt": {:git, "https://github.com/msantos/crypt", "f63a705f92c26955977ee62a313012e309a4d77a", [ref: "f63a705f92c26955977ee62a313012e309a4d77a"]},
   "custom_base": {:hex, :custom_base, "0.2.1", "4a832a42ea0552299d81652aa0b1f775d462175293e99dfbe4d7dbaab785a706", [:mix], [], "hexpm", "8df019facc5ec9603e94f7270f1ac73ddf339f56ade76a721eaa57c1493ba463"},
-  "db_connection": {:hex, :db_connection, "2.2.1", "caee17725495f5129cb7faebde001dc4406796f12a62b8949f4ac69315080566", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "2b02ece62d9f983fcd40954e443b7d9e6589664380e5546b2b9b523cd0fb59e1"},
+  "db_connection": {:hex, :db_connection, "2.2.2", "3bbca41b199e1598245b716248964926303b5d4609ff065125ce98bcd368939e", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "642af240d8a8affb93b4ba5a6fcd2bbcbdc327e1a524b825d383711536f8070c"},
   "decimal": {:hex, :decimal, "1.8.1", "a4ef3f5f3428bdbc0d35374029ffcf4ede8533536fa79896dd450168d9acdf3c", [:mix], [], "hexpm", "3cb154b00225ac687f6cbd4acc4b7960027c757a5152b369923ead9ddbca7aec"},
   "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"},
   "earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm", "8cf8a291ebf1c7b9539e3cddb19e9cef066c2441b1640f13c34c1d3cfc825fec"},
-  "ecto": {:hex, :ecto, "3.4.4", "a2c881e80dc756d648197ae0d936216c0308370332c5e77a2325a10293eef845", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "cc4bd3ad62abc3b21fb629f0f7a3dab23a192fca837d257dd08449fba7373561"},
+  "ecto": {:hex, :ecto, "3.4.5", "2bcd262f57b2c888b0bd7f7a28c8a48aa11dc1a2c6a858e45dd8f8426d504265", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "8c6d1d4d524559e9b7a062f0498e2c206122552d63eacff0a6567ffe7a8e8691"},
   "ecto_enum": {:hex, :ecto_enum, "1.4.0", "d14b00e04b974afc69c251632d1e49594d899067ee2b376277efd8233027aec8", [:mix], [{:ecto, ">= 3.0.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "> 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:mariaex, ">= 0.0.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "8fb55c087181c2b15eee406519dc22578fa60dd82c088be376d0010172764ee4"},
   "ecto_sql": {:hex, :ecto_sql, "3.3.4", "aa18af12eb875fbcda2f75e608b3bd534ebf020fc4f6448e4672fcdcbb081244", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4 or ~> 3.3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5eccbdbf92e3c6f213007a82d5dbba4cd9bb659d1a21331f89f408e4c0efd7a8"},
   "elixir_make": {:hex, :elixir_make, "0.6.0", "38349f3e29aff4864352084fc736fa7fa0f2995a819a737554f7ebd28b85aaab", [:mix], [], "hexpm", "d522695b93b7f0b4c0fcb2dfe73a6b905b1c301226a5a55cb42e5b14d509e050"},
@@ -75,7 +75,7 @@
   "myhtmlex": {:git, "https://git.pleroma.social/pleroma/myhtmlex.git", "ad0097e2f61d4953bfef20fb6abddf23b87111e6", [ref: "ad0097e2f61d4953bfef20fb6abddf23b87111e6", submodules: true]},
   "nimble_parsec": {:hex, :nimble_parsec, "0.5.3", "def21c10a9ed70ce22754fdeea0810dafd53c2db3219a0cd54cf5526377af1c6", [:mix], [], "hexpm", "589b5af56f4afca65217a1f3eb3fee7e79b09c40c742fddc1c312b3ac0b3399f"},
   "nodex": {:git, "https://git.pleroma.social/pleroma/nodex", "cb6730f943cfc6aad674c92161be23a8411f15d1", [ref: "cb6730f943cfc6aad674c92161be23a8411f15d1"]},
-  "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.1", "be0be1769578ff8da1818fd9685838d49bd9c83660cd593c48ac6633638171e0", [: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", "3ae0dacbd39babd82468f290073b5e58618df0cca1b48cc60d8c1ff1757d4c01"},
   "open_api_spex": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/open_api_spex.git", "f296ac0924ba3cf79c7a588c4c252889df4c2edd", [ref: "f296ac0924ba3cf79c7a588c4c252889df4c2edd"]},
   "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"},
   "pbkdf2_elixir": {:hex, :pbkdf2_elixir, "1.2.1", "9cbe354b58121075bd20eb83076900a3832324b7dd171a6895fab57b6bb2752c", [:mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}], "hexpm", "d3b40a4a4630f0b442f19eca891fcfeeee4c40871936fed2f68e1c4faa30481f"},
@@ -90,7 +90,7 @@
   "plug_static_index_html": {:hex, :plug_static_index_html, "1.0.0", "840123d4d3975585133485ea86af73cb2600afd7f2a976f9f5fd8b3808e636a0", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "79fd4fcf34d110605c26560cbae8f23c603ec4158c08298bd4360fdea90bb5cf"},
   "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm", "fec8660eb7733ee4117b85f55799fd3833eb769a6df71ccf8903e8dc5447cfce"},
   "poolboy": {:hex, :poolboy, "1.5.2", "392b007a1693a64540cead79830443abf5762f5d30cf50bc95cb2c1aaafa006b", [:rebar3], [], "hexpm", "dad79704ce5440f3d5a3681c8590b9dc25d1a561e8f5a9c995281012860901e3"},
-  "postgrex": {:hex, :postgrex, "0.15.3", "5806baa8a19a68c4d07c7a624ccdb9b57e89cbc573f1b98099e3741214746ae4", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "4737ce62a31747b4c63c12b20c62307e51bb4fcd730ca0c32c280991e0606c90"},
+  "postgrex": {:hex, :postgrex, "0.15.5", "aec40306a622d459b01bff890fa42f1430dac61593b122754144ad9033a2152f", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "ed90c81e1525f65a2ba2279dbcebf030d6d13328daa2f8088b9661eb9143af7f"},
   "pot": {:hex, :pot, "0.10.2", "9895c83bcff8cd22d9f5bc79dfc88a188176b261b618ad70d93faf5c5ca36e67", [:rebar3], [], "hexpm", "ac589a8e296b7802681e93cd0a436faec117ea63e9916709c628df31e17e91e2"},
   "prometheus": {:hex, :prometheus, "4.5.0", "8f4a2246fe0beb50af0f77c5e0a5bb78fe575c34a9655d7f8bc743aad1c6bf76", [:mix, :rebar3], [], "hexpm", "679b5215480fff612b8351f45c839d995a07ce403e42ff02f1c6b20960d41a4e"},
   "prometheus_ecto": {:hex, :prometheus_ecto, "1.4.3", "3dd4da1812b8e0dbee81ea58bb3b62ed7588f2eae0c9e97e434c46807ff82311", [:mix], [{:ecto, "~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:prometheus_ex, "~> 1.1 or ~> 2.0 or ~> 3.0", [hex: :prometheus_ex, repo: "hexpm", optional: false]}], "hexpm", "8d66289f77f913b37eda81fd287340c17e61a447549deb28efc254532b2bed82"},
index e899d45093660d001675e69f8068004c8299a838..d75c06cc7e61aaad1a2dc22f32ec24334c67c691 100644 (file)
@@ -44,7 +44,7 @@ defmodule Pleroma.ActivityExpirationTest do
         %{activity_id: activity.id, scheduled_at: naive_datetime}
       )
 
-    Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker.perform(:ops, :pid)
+    Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker.perform(%Oban.Job{})
 
     refute Pleroma.Repo.get(Pleroma.Activity, activity.id)
     refute Pleroma.Repo.get(Pleroma.ActivityExpiration, expiration.id)
index e96994c5760e1ad2f3a1830df8bf249e670429c4..9f90a821ce786bc3d1944131d123bc4695721280 100644 (file)
@@ -20,7 +20,7 @@ defmodule Pleroma.Tests.ObanHelpers do
   end
 
   def perform(%Oban.Job{} = job) do
-    res = apply(String.to_existing_atom("Elixir." <> job.worker), :perform, [job.args, job])
+    res = apply(String.to_existing_atom("Elixir." <> job.worker), :perform, [job])
     Repo.delete(job)
     res
   end
index 7693f6400d07524cedd0bed93b5a716365999b26..8a1cd6f1210c17470738037678378ab1ce5820e9 100644 (file)
@@ -1457,7 +1457,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
 
       assert_enqueued(worker: Pleroma.Workers.BackgroundWorker, args: params)
 
-      Pleroma.Workers.BackgroundWorker.perform(params, nil)
+      Pleroma.Workers.BackgroundWorker.perform(%Oban.Job{args: params})
 
       refute User.following?(follower, old_user)
       assert User.following?(follower, new_user)
index df82dc75db87485d297854fbdeac438eefe7967f..67836f34f8a7a245e8ce6e3135f3feb2fa0d4615 100644 (file)
@@ -16,7 +16,7 @@ defmodule Pleroma.Workers.Cron.ClearOauthTokenWorkerTest do
     )
 
     Pleroma.Config.put([:oauth2, :clean_expired_tokens], true)
-    ClearOauthTokenWorker.perform(:opts, :job)
+    ClearOauthTokenWorker.perform(%Oban.Job{})
     assert Pleroma.Repo.all(Pleroma.Web.OAuth.Token) == []
   end
 end
index f9bc50db52cc825a87f9dd2a0d5cfdfaec1db9d8..65887192ea2e954e4ffa9974a97a539eda6b9f4a 100644 (file)
@@ -35,7 +35,7 @@ defmodule Pleroma.Workers.Cron.DigestEmailsWorkerTest do
   end
 
   test "it sends digest emails", %{user2: user2} do
-    Pleroma.Workers.Cron.DigestEmailsWorker.perform(:opts, :pid)
+    Pleroma.Workers.Cron.DigestEmailsWorker.perform(%Oban.Job{})
     # Performing job(s) enqueued at previous step
     ObanHelpers.perform_all()
 
@@ -47,7 +47,7 @@ defmodule Pleroma.Workers.Cron.DigestEmailsWorkerTest do
   test "it doesn't fail when a user has no email", %{user2: user2} do
     {:ok, _} = user2 |> Ecto.Changeset.change(%{email: nil}) |> Pleroma.Repo.update()
 
-    Pleroma.Workers.Cron.DigestEmailsWorker.perform(:opts, :pid)
+    Pleroma.Workers.Cron.DigestEmailsWorker.perform(%Oban.Job{})
     # Performing job(s) enqueued at previous step
     ObanHelpers.perform_all()
   end
index ee589bb55facd8061b9dd91b13e6e9deb328b229..129534cb1695df351c576492fdac738a1ac27fe5 100644 (file)
@@ -17,7 +17,7 @@ defmodule Pleroma.Workers.Cron.NewUsersDigestWorkerTest do
     user2 = insert(:user, %{inserted_at: yesterday})
     CommonAPI.post(user, %{status: "cofe"})
 
-    NewUsersDigestWorker.perform(nil, nil)
+    NewUsersDigestWorker.perform(%Oban.Job{})
     ObanHelpers.perform_all()
 
     assert_received {:email, email}
@@ -39,7 +39,7 @@ defmodule Pleroma.Workers.Cron.NewUsersDigestWorkerTest do
 
     CommonAPI.post(user, %{status: "cofe"})
 
-    NewUsersDigestWorker.perform(nil, nil)
+    NewUsersDigestWorker.perform(%Oban.Job{})
     ObanHelpers.perform_all()
   end
 end
index 6d2991a6071d3b19ea5aab0d787fa86a2f007a9f..5b2ffbc4c283b8faa66ee4e01fa300fd25fa293d 100644 (file)
@@ -33,7 +33,7 @@ defmodule Pleroma.Workers.Cron.PurgeExpiredActivitiesWorkerTest do
         %{activity_id: activity.id, scheduled_at: naive_datetime}
       )
 
-    Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker.perform(:ops, :pid)
+    Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker.perform(%Oban.Job{})
 
     refute Pleroma.Repo.get(Pleroma.Activity, activity.id)
     refute Pleroma.Repo.get(Pleroma.ActivityExpiration, expiration.id)
@@ -62,7 +62,7 @@ defmodule Pleroma.Workers.Cron.PurgeExpiredActivitiesWorkerTest do
     |> Ecto.Changeset.change(%{scheduled_at: past_date})
     |> Repo.update!()
 
-    Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker.perform(:ops, :pid)
+    Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker.perform(%Oban.Job{})
 
     assert [%{data: %{"type" => "Delete", "deleted_activity_id" => ^id}}] =
              Pleroma.Repo.all(Pleroma.Activity)
index b312d975bf26273ee156acbfc3837851f5b60df0..f3eddf7b14a12531e6778fb15db50466f32da585 100644 (file)
@@ -32,10 +32,7 @@ defmodule Pleroma.Workers.ScheduledActivityWorkerTest do
         params: %{status: "hi"}
       )
 
-    ScheduledActivityWorker.perform(
-      %{"activity_id" => scheduled_activity.id},
-      :pid
-    )
+    ScheduledActivityWorker.perform(%Oban.Job{args: %{"activity_id" => scheduled_activity.id}})
 
     refute Repo.get(ScheduledActivity, scheduled_activity.id)
     activity = Repo.all(Pleroma.Activity) |> Enum.find(&(&1.actor == user.ap_id))
@@ -46,7 +43,7 @@ defmodule Pleroma.Workers.ScheduledActivityWorkerTest do
     Pleroma.Config.put([ScheduledActivity, :enabled], true)
 
     assert capture_log([level: :error], fn ->
-             ScheduledActivityWorker.perform(%{"activity_id" => 42}, :pid)
+             ScheduledActivityWorker.perform(%Oban.Job{args: %{"activity_id" => 42}})
            end) =~ "Couldn't find scheduled activity"
   end
 end