ActivityPub.Federator.Workers.PublisherWorker (Bonfire v1.0.1-social-alpha.21)

View Source

Summary

Functions

Returns worker args with Oban's scheduled_at set if the activity's published date is in the future.

Default perform/1 implementation. Calls perform_job/1, handling rate limiting by snoozing the job.

Functions

enqueue(op, params, worker_args \\ [])

enqueueable(op, params, worker_args \\ [])

maybe_schedule_worker_args(arg1, worker_args)

Returns worker args with Oban's scheduled_at set if the activity's published date is in the future.

Examples

iex> now = DateTime.utc_now()
iex> future = DateTime.add(now, 3600, :second) |> DateTime.to_iso8601()
iex> params = %{"object" => %{"published" => future}}
iex> ActivityPub.Federator.Workers.PublisherWorker.maybe_schedule_worker_args(params, []) |> Keyword.has_key?(:scheduled_at)
true

iex> params = %{"published" => DateTime.utc_now() |> DateTime.to_iso8601()}
iex> ActivityPub.Federator.Workers.PublisherWorker.maybe_schedule_worker_args(params, [])
[]

perform(job)

Default perform/1 implementation. Calls perform_job/1, handling rate limiting by snoozing the job.