diff options
author | William Pitcock <nenolod@dereferenced.org> | 2018-08-06 07:27:11 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2018-08-06 08:22:12 +0000 |
commit | 266b3140519eacc6c0adaccd959e2f3167e1fc13 (patch) | |
tree | cce0861a019e93b2fa5de8cf2b02950b0989c526 | |
parent | 99be3d3dccbbd7877192c6291bbaae92f66e06bf (diff) | |
download | pleroma-266b3140519eacc6c0adaccd959e2f3167e1fc13.tar.gz |
relay: fix invoking federator, use a timer to sleep the mix task to force a context switch
-rw-r--r-- | lib/mix/tasks/relay_follow.ex | 3 | ||||
-rw-r--r-- | lib/mix/tasks/relay_unfollow.ex | 3 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/relay.ex | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/lib/mix/tasks/relay_follow.ex b/lib/mix/tasks/relay_follow.ex index a8152d96f..ac6f20924 100644 --- a/lib/mix/tasks/relay_follow.ex +++ b/lib/mix/tasks/relay_follow.ex @@ -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 diff --git a/lib/mix/tasks/relay_unfollow.ex b/lib/mix/tasks/relay_unfollow.ex index 81b7197b2..4621ace83 100644 --- a/lib/mix/tasks/relay_unfollow.ex +++ b/lib/mix/tasks/relay_unfollow.ex @@ -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 diff --git a/lib/pleroma/web/activity_pub/relay.ex b/lib/pleroma/web/activity_pub/relay.ex index 8b49188fb..29ece7f1b 100644 --- a/lib/pleroma/web/activity_pub/relay.ex +++ b/lib/pleroma/web/activity_pub/relay.ex @@ -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)}") |