*`enabled` - whether the scheduler is enabled (Default: `false`)
*`poll_interval` - how often to check for scheduled jobs in milliseconds (Default: `10_000`)
*`store` - a module that stores scheduled jobs. It should implement the `PleromaJobQueue.Scheduler.Store` behavior. The default is an in-memory store based on ETS tables: `PleromaJobQueue.Scheduler.Store.ETS`.
The scheduler allows you to execute jobs at specific time in the future.
By default it uses an in-memory ETS table which means the jobs won't be available after restart.
* `enabled` - whether the scheduler is enabled (Default: `true`)
* `poll_interval` - how often to check for scheduled jobs in milliseconds (Default: `10_000`)
* `store` - a module that stores scheduled jobs. It should implement the `PleromaJobQueue.Scheduler.Store` behavior. The default is an in-memory store based on ETS tables: `PleromaJobQueue.Scheduler.Store.ETS`.
The scheduler allows you to execute jobs at specific time in the future.
By default it uses an in-memory ETS table which means the jobs won't be available after restart.
"""
@doc"""
...
...
@@ -42,10 +58,10 @@ defmodule PleromaJobQueue do
## Arguments
- `queue_name` - a queue name(must be specified in the config).
- `mod` - a worker module (must have `perform` function).
- `args` - a list of arguments for the `perform` function of the worker module.
- `priority` - a job priority (`1` by default). The higher number has a lower priority.
* `queue_name` - a queue name(must be specified in the config).
* `mod` - a worker module (must have `perform` function).
* `args` - a list of arguments for the `perform` function of the worker module.
* `priority` - a job priority (`1` by default). The higher number has a lower priority.
## Examples
...
...
@@ -81,6 +97,59 @@ defmodule PleromaJobQueue do
end
end
@doc"""
Schedules a job to be enqueued at specific time in the future.
## Arguments
* `timestamp` - a unix timestamp in milliseconds
* `queue_name` - a queue name (must be specified in the config).
* `mod` - a worker module (must have `perform` function).
* `args` - a list of arguments for the `perform` function of the worker module.
* `priority` - a job priority (`1` by default). The higher number has a lower priority.
## Examples
Enqueue `MyWorker.perform/0` at specific time:
iex> time = DateTime.to_unix(DateTime.utc_now(), :millisecond)