Skip to content

no function clause matching in Quantum.Normalizer.normalize_task/1 #533

Description

@BryanJBryce

Sorry, this seems like something really basic, but I can't figure out what I'm doing wrong.

I've added Quantum to dependencies.

{:quantum, "~> 3.5"}

I've created a scheduler module:

defmodule Quest.Scheduler do
  use Quantum, otp_app: :quest
end

I've added that to the Supervisor children list:

children = [
   ...
      Quest.Scheduler,
   ...
    ]

And I've created a function to run with a schedule in the Schedule module (here are 3 of them to try to match the config one):

defmodule Quest.Scheduler do
  use Quantum, otp_app: :quest

  def do_it() do
    IO.puts("YOLO!!!")
  end

  def do_it([]) do
    IO.puts("ROLO!!!")
  end

  def do_it(_opts) do
    IO.puts("ZOLO!!!")
  end
end

Here is my cron job from config.exs

config :quest, Quest.Scheduler,
  jobs: [
    # Every minute
    {"* * * * *", {Quest.Scheduler, :do_it}, []}
  ]

I've also tried this:

config :quest, Quest.Scheduler,
  jobs: [
    # Every minute
    {"* * * * *", {Quest.Scheduler, :do_it}}
  ]

But get this error saying there is no function that matches:

** (Mix) Could not start application quest: Quest.Application.start(:normal, []) returned an error: shutdown: failed to start child: Quest.Scheduler
** (EXIT) an exception was raised:
** (FunctionClauseError) no function clause matching in Quantum.Normalizer.normalize_task/1
(quantum 3.5.0) lib/quantum/normalizer.ex:95: Quantum.Normalizer.normalize_task({Quest.Scheduler, :do_it})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions