Commit e4a4135c authored by lain's avatar lain
Browse files

Handle subscriptions in queue.

parent 54af9e14
......@@ -26,6 +26,15 @@ def handle(:refresh_subscriptions, _) do
end)
end
def handle(:request_subscription, websub) do
Logger.debug("Refreshing #{websub.topic}")
with {:ok, websub } <- Websub.request_subscription(websub) do
Logger.debug("Successfully refreshed #{websub.topic}")
else
_e -> Logger.debug("Couldn't refresh #{websub.topic}")
end
end
def handle(:publish, activity) do
Logger.debug(fn -> "Running publish for #{activity.data["id"]}" end)
with actor when not is_nil(actor) <- User.get_cached_by_ap_id(activity.data["actor"]) do
......
......@@ -216,8 +216,8 @@ def refresh_subscriptions(delta \\ 60 * 60 * 24) do
subs = Repo.all(query)
Enum.map(subs, fn (sub) ->
request_subscription(sub)
Enum.each(subs, fn (sub) ->
Pleroma.Web.Federator.enqueue(:request_subscription, sub)
end)
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment