Add option to modify HTTP pool size
[akkoma] / lib / pleroma / workers / search_indexing_worker.ex
1 defmodule Pleroma.Workers.SearchIndexingWorker do
2 use Pleroma.Workers.WorkerHelper, queue: "search_indexing"
3
4 @impl Oban.Worker
5
6 def perform(%Job{args: %{"op" => "add_to_index", "activity" => activity_id}}) do
7 activity = Pleroma.Activity.get_by_id_with_object(activity_id)
8
9 search_module = Pleroma.Config.get([Pleroma.Search, :module])
10
11 search_module.add_to_index(activity)
12
13 :ok
14 end
15
16 def perform(%Job{args: %{"op" => "remove_from_index", "object" => object_id}}) do
17 search_module = Pleroma.Config.get([Pleroma.Search, :module])
18
19 # Fake the object so we can remove it from the index without having to keep it in the DB
20 search_module.remove_from_index(%Pleroma.Object{id: object_id})
21
22 :ok
23 end
24 end