forked from AkkomaGang/akkoma
lib/mix/tasks/relay_{un,}follow.ex: Use a with block
This commit is contained in:
parent
ccd6b1956d
commit
1a31d71187
2 changed files with 12 additions and 8 deletions
|
@ -14,9 +14,11 @@ defmodule Mix.Tasks.RelayFollow do
|
||||||
def run([target]) do
|
def run([target]) do
|
||||||
Mix.Task.run("app.start")
|
Mix.Task.run("app.start")
|
||||||
|
|
||||||
_status = Relay.follow(target)
|
with :ok <- Relay.follow(target) do
|
||||||
|
|
||||||
# put this task to sleep to allow the genserver to push out the messages
|
# put this task to sleep to allow the genserver to push out the messages
|
||||||
:timer.sleep(500)
|
:timer.sleep(500)
|
||||||
|
else
|
||||||
|
e -> Mix.puts("Error: #{inspect(e)}")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,9 +13,11 @@ defmodule Mix.Tasks.RelayUnfollow do
|
||||||
def run([target]) do
|
def run([target]) do
|
||||||
Mix.Task.run("app.start")
|
Mix.Task.run("app.start")
|
||||||
|
|
||||||
_status = Relay.unfollow(target)
|
with :ok <- Relay.unfollow(target) do
|
||||||
|
|
||||||
# put this task to sleep to allow the genserver to push out the messages
|
# put this task to sleep to allow the genserver to push out the messages
|
||||||
:timer.sleep(500)
|
:timer.sleep(500)
|
||||||
|
else
|
||||||
|
e -> Mix.puts("Error: #{inspect(e)}")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue