Closed functionistic closed 2 years ago
mix new
{:quantum, "~> 3.4"}
mix.exs
iex -S mix
iex(1)> import Crontab.CronExpression Crontab.CronExpression iex(2)> Scheduler.new_job() |> Quantum.Job.set_name(:ticker) |> Quantum.Job.set_schedule(~e[*/1 * * * *]) |> Scheduler.add_job() :ok iex(3)> 13:09:29.644 [debug] Adding job
13:09:29.646 [debug] Adding job iex(3)> Scheduler.new_job() |> Quantum.Job.set_name(:ticker) |> Quantum.Job.set_schedule(~e[/2 *]) |> Scheduler.add_job()
13:09:33.543 [debug] Replacing job :ok iex(4)> 13:09:33.546 [error] GenServer Scheduler.ExecutionBroadcaster terminating * (FunctionClauseError) no function clause matching in Quantum.ExecutionBroadcaster.handle_event/2 (quantum 3.4.0) lib/quantum/execution_broadcaster.ex:98: Quantum.ExecutionBroadcaster.handle_event({:delete, %Quantum.Job{name: :ticker, overlap: true, run_strategy: %Quantum.RunStrategy.Random{nodes: :cluster}, schedule: ~e[/1 ], state: :active, task: nil, timezone: :utc}}, %Quantum.ExecutionBroadcaster.State{debug_logging: true, execution_timeline: [{~N[2021-12-30 13:10:00], [%Quantum.Job{name: :ticker, overlap: true, run_strategy: %Quantum.RunStrategy.Random{nodes: :cluster}, schedule: ~e[/1 ], state: :active, task: nil, timezone: :utc}]}], scheduler: Scheduler, storage: Quantum.Storage.Noop, storage_pid: nil, uninitialized_jobs: []}) (quantum 3.4.0) lib/quantum/execution_broadcaster.ex:91: anonymous fn/2 in Quantum.ExecutionBroadcaster.handle_events/3 (elixir 1.12.2) lib/enum.ex:2385: Enum."-reduce/3-lists^foldl/2-0-"/3 (quantum 3.4.0) lib/quantum/execution_broadcaster.ex:90: Quantum.ExecutionBroadcaster.handle_events/3 (gen_stage 1.1.2) lib/gen_stage.ex:2471: GenStage.consumer_dispatch/6 (gen_stage 1.1.2) lib/gen_stage.ex:2660: GenStage.take_pc_events/3 (stdlib 3.16.1) gen_server.erl:695: :gen_server.try_dispatch/4 (stdlib 3.16.1) gen_server.erl:771: :gen_server.handle_msg/6 Last message: {:"$gen_consumer", {#PID<0.216.0>, #Reference<0.1649589661.2724200449.234145>}, [delete: %Quantum.Job{name: :ticker, overlap: true, run_strategy: %Quantum.RunStrategy.Random{nodes: :cluster}, schedule: ~e[/1 ], state: :active, task: nil, timezone: :utc}, add: %Quantum.Job{name: :ticker, overlap: true, run_strategy: %Quantum.RunStrategy.Random{nodes: :cluster}, schedule: ~e[/2 ], state: :active, task: nil, timezone: :utc}]} State: %Quantum.ExecutionBroadcaster.State{debug_logging: true, execution_timeline: [{~N[2021-12-30 13:10:00], [%Quantum.Job{name: :ticker, overlap: true, run_strategy: %Quantum.RunStrategy.Random{nodes: :cluster}, schedule: ~e[/1 *], state: :active, task: nil, timezone: :utc}]}], scheduler: Scheduler, storage: Quantum.Storage.Noop, storage_pid: nil, uninitialized_jobs: []}`
There even seems to already exist a test for this in `job_broadcaster_test.exs`. Maybe there is something wrong with my setup.
Steps to reproduce
mix new
{:quantum, "~> 3.4"}
mix.exs
iex -S mix
13:09:29.646 [debug] Adding job iex(3)> Scheduler.new_job() |> Quantum.Job.set_name(:ticker) |> Quantum.Job.set_schedule(~e[/2 *]) |> Scheduler.add_job()
13:09:33.543 [debug] Replacing job :ok iex(4)> 13:09:33.546 [error] GenServer Scheduler.ExecutionBroadcaster terminating * (FunctionClauseError) no function clause matching in Quantum.ExecutionBroadcaster.handle_event/2 (quantum 3.4.0) lib/quantum/execution_broadcaster.ex:98: Quantum.ExecutionBroadcaster.handle_event({:delete, %Quantum.Job{name: :ticker, overlap: true, run_strategy: %Quantum.RunStrategy.Random{nodes: :cluster}, schedule: ~e[/1 ], state: :active, task: nil, timezone: :utc}}, %Quantum.ExecutionBroadcaster.State{debug_logging: true, execution_timeline: [{~N[2021-12-30 13:10:00], [%Quantum.Job{name: :ticker, overlap: true, run_strategy: %Quantum.RunStrategy.Random{nodes: :cluster}, schedule: ~e[/1 ], state: :active, task: nil, timezone: :utc}]}], scheduler: Scheduler, storage: Quantum.Storage.Noop, storage_pid: nil, uninitialized_jobs: []}) (quantum 3.4.0) lib/quantum/execution_broadcaster.ex:91: anonymous fn/2 in Quantum.ExecutionBroadcaster.handle_events/3 (elixir 1.12.2) lib/enum.ex:2385: Enum."-reduce/3-lists^foldl/2-0-"/3 (quantum 3.4.0) lib/quantum/execution_broadcaster.ex:90: Quantum.ExecutionBroadcaster.handle_events/3 (gen_stage 1.1.2) lib/gen_stage.ex:2471: GenStage.consumer_dispatch/6 (gen_stage 1.1.2) lib/gen_stage.ex:2660: GenStage.take_pc_events/3 (stdlib 3.16.1) gen_server.erl:695: :gen_server.try_dispatch/4 (stdlib 3.16.1) gen_server.erl:771: :gen_server.handle_msg/6 Last message: {:"$gen_consumer", {#PID<0.216.0>, #Reference<0.1649589661.2724200449.234145>}, [delete: %Quantum.Job{name: :ticker, overlap: true, run_strategy: %Quantum.RunStrategy.Random{nodes: :cluster}, schedule: ~e[/1 ], state: :active, task: nil, timezone: :utc}, add: %Quantum.Job{name: :ticker, overlap: true, run_strategy: %Quantum.RunStrategy.Random{nodes: :cluster}, schedule: ~e[/2 ], state: :active, task: nil, timezone: :utc}]} State: %Quantum.ExecutionBroadcaster.State{debug_logging: true, execution_timeline: [{~N[2021-12-30 13:10:00], [%Quantum.Job{name: :ticker, overlap: true, run_strategy: %Quantum.RunStrategy.Random{nodes: :cluster}, schedule: ~e[/1 *], state: :active, task: nil, timezone: :utc}]}], scheduler: Scheduler, storage: Quantum.Storage.Noop, storage_pid: nil, uninitialized_jobs: []}`