relay: fix invoking federator, use a timer to sleep the mix task to force a context switch
This commit is contained in:
parent
99be3d3dcc
commit
266b314051
@ -8,5 +8,8 @@ defmodule Mix.Tasks.RelayFollow do
|
||||
Mix.Task.run("app.start")
|
||||
|
||||
:ok = Relay.follow(target)
|
||||
|
||||
# put this task to sleep to allow the genserver to push out the messages
|
||||
:timer.sleep(500)
|
||||
end
|
||||
end
|
||||
|
@ -8,5 +8,8 @@ defmodule Mix.Tasks.RelayUnfollow do
|
||||
Mix.Task.run("app.start")
|
||||
|
||||
:ok = Relay.unfollow(target)
|
||||
|
||||
# put this task to sleep to allow the genserver to push out the messages
|
||||
:timer.sleep(500)
|
||||
end
|
||||
end
|
||||
|
@ -11,7 +11,6 @@ defmodule Pleroma.Web.ActivityPub.Relay do
|
||||
with %User{} = local_user <- get_actor(),
|
||||
%User{} = target_user <- User.get_or_fetch_by_ap_id(target_instance),
|
||||
{:ok, activity} <- ActivityPub.follow(local_user, target_user) do
|
||||
ActivityPub.publish(local_user, activity)
|
||||
Logger.info("relay: followed instance: #{target_instance}; id=#{activity.data["id"]}")
|
||||
else
|
||||
e -> Logger.error("error: #{inspect(e)}")
|
||||
@ -24,7 +23,6 @@ defmodule Pleroma.Web.ActivityPub.Relay do
|
||||
with %User{} = local_user <- get_actor(),
|
||||
%User{} = target_user <- User.get_or_fetch_by_ap_id(target_instance),
|
||||
{:ok, activity} <- ActivityPub.unfollow(local_user, target_user) do
|
||||
ActivityPub.publish(local_user, activity)
|
||||
Logger.info("relay: unfollowed instance: #{target_instance}: id=#{activity.data["id"]}")
|
||||
else
|
||||
e -> Logger.error("error: #{inspect(e)}")
|
||||
|
Loading…
Reference in New Issue
Block a user