Fledex.Scheduler.Runner (Fledex_Scheduler v0.3.0)

View Source

This module is the actual process that Fledex.Scheduler (as a facade with a lot of convenience functions) is using. You can use this module also directly if you need more control.

Summary

Functions

Cancels future invocation of the given process. If it has already been invoked, does nothing.

This job allows to change an already existing job.

Returns a specification to start this module under a supervisor.

This function allows to interrogate when the specified job will run the next time relative to the last time the job was scheduled.

This function is the same as start_link/3 and is only here for compatibility reasons

Main point of entry into this module. Starts and returns a process which will run the given function per the specified job definition

Types

t()

@type t() :: %{
  job: Fledex.Scheduler.Job.t() | nil,
  timer_ref: reference() | nil,
  quantized_scheduled_at: DateTime.t() | nil,
  scheduled_at: DateTime.t() | nil,
  delay: pos_integer() | nil,
  test_opts: test_opts()
}

test_opts()

@type test_opts() :: keyword()

Functions

cancel(server)

@spec cancel(GenServer.server()) :: :ok

Cancels future invocation of the given process. If it has already been invoked, does nothing.

change_config(server, job, test_opts)

@spec change_config(GenServer.server(), Fledex.Scheduler.Job.t(), test_opts()) :: :ok

This job allows to change an already existing job.

The job is identified through it's name and that's the only part that is not allowed to change. The arguments are otherwise the same as for run/2. If there is nothing to schedule (or an error happens, the process will terminate)

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

next_schedule(server)

@spec next_schedule(GenServer.server()) :: {DateTime.t(), DateTime.t(), pos_integer()}

This function allows to interrogate when the specified job will run the next time relative to the last time the job was scheduled.

The response is a tuple with the scheduled date/time, the quantized scheduled date/time, and the delay (in milliseconds) until the next run.

run(job, test_opts, server_opts \\ [])

This function is the same as start_link/3 and is only here for compatibility reasons

start_link(job, test_opts \\ [], server_opts \\ [])

Main point of entry into this module. Starts and returns a process which will run the given function per the specified job definition