Skip to content

Commit

Permalink
Fix past UNIX timestamp in SC datetime trigger (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmanzanera committed Oct 12, 2022
1 parent 7ec19d4 commit 8b92a8a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/archethic/contracts/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ defmodule Archethic.Contracts.Worker do

defp schedule_trigger(trigger = %Trigger{type: :datetime, opts: [at: datetime = %DateTime{}]}) do
seconds = DateTime.diff(datetime, DateTime.utc_now())
Process.send_after(self(), trigger, seconds * 1000)

if seconds > 0 do
Process.send_after(self(), trigger, seconds * 1000)
end
end

defp schedule_trigger(%Trigger{type: :oracle}) do
Expand Down

0 comments on commit 8b92a8a

Please sign in to comment.