From e33be9c8de11e1ea1f312324ac56dfa8f3f07566 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Thu, 19 Dec 2019 23:14:14 -0500 Subject: [PATCH] sleep first, then request --- lib/philomena/servers/picarto_channel_updater.ex | 3 ++- lib/philomena/servers/piczel_channel_updater.ex | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/philomena/servers/picarto_channel_updater.ex b/lib/philomena/servers/picarto_channel_updater.ex index c1798675..392797e8 100644 --- a/lib/philomena/servers/picarto_channel_updater.ex +++ b/lib/philomena/servers/picarto_channel_updater.ex @@ -17,13 +17,14 @@ defmodule Philomena.Servers.PicartoChannelUpdater do end defp run do + :timer.sleep(:timer.seconds(60)) + now = DateTime.utc_now() |> DateTime.truncate(:second) @api_online |> Philomena.Http.get!() |> handle_response(now) - :timer.sleep(:timer.seconds(60)) run() end diff --git a/lib/philomena/servers/piczel_channel_updater.ex b/lib/philomena/servers/piczel_channel_updater.ex index b685f334..0a1717b7 100644 --- a/lib/philomena/servers/piczel_channel_updater.ex +++ b/lib/philomena/servers/piczel_channel_updater.ex @@ -17,13 +17,14 @@ defmodule Philomena.Servers.PiczelChannelUpdater do end defp run do + :timer.sleep(:timer.seconds(60)) + now = DateTime.utc_now() |> DateTime.truncate(:second) @api_online |> Philomena.Http.get!() |> handle_response(now) - :timer.sleep(:timer.seconds(60)) run() end