The Oban queue share cards are drawn on, :share_cards, and how many are drawn at once: the
share_cards.workers setting (Settings → SEO → Share cards, master only), from 0 to 4, 1 by
default. 0 pauses the queue: the cards wait in it, and are drawn once it is set above 0 again.
Every job that draws a share card, or looks at one, runs on it:
MishkaCmsCore.Runtime.ShareCard and MishkaCmsCore.Runtime.Workers.ShareCardRefreshWorker,
and an extension's or a site's own drawing worker the same way, use Oban.Worker, queue: :share_cards. So a redraw of every card of a site — after its address changes — draws one card
at a time, and never holds up a stylesheet build on :assets.
A host lists the queue in its Oban queues, paused, and the boot starts it:
config :my_app, Oban,
queues: [default: 5, assets: 2, share_cards: [limit: 1, paused: true]]When the setting is applied
- when it is saved: this module is a mishka_installer plugin on
cms_core:setting:after_save, and scales, pauses or resumes the queue on every node of the cluster through Oban's notifier (Oban.scale_queue/2,Oban.pause_queue/2,Oban.resume_queue/2); - when a node starts:
MishkaCmsCore.Runtime.Handlers.BootHandlercallsboot/1, which applies the stored value to that node's own queue — on a node that serves the site. One that does not (MishkaCmsCore.Runtime.Handlers.BootHandler.serving?/0) leaves the queue as the app started it, paused, or not there at all underMishkaCmsCore.Runtime.Handlers.BootHandler.oban_config/1.
Registered in MishkaCmsCore.Application.
Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for MishkaInstaller.Event.Hook.enable/0.
Callback implementation for MishkaInstaller.Event.Hook.get/0.
Optional. See MishkaInstaller.Event.Hook.health_check/0. Override to report health.
The setting that says how many share cards are drawn at once.
Optional. See MishkaInstaller.Event.Hook.on_dependency_error/1. Override to react.
The queue every share-card job runs on.
Callback implementation for MishkaInstaller.Event.Hook.register/0.
Callback implementation for MishkaInstaller.Event.Hook.restart/0.
Draws workers share cards at once: the queue scaled to that many and resumed, or paused for 0.
The setting's definition, on the SEO tab of the settings page.
Callback implementation for MishkaInstaller.Event.Hook.start/0.
Callback implementation for MishkaInstaller.Event.Hook.stop/0.
Callback implementation for MishkaInstaller.Event.Hook.unregister/0.
How many share cards are drawn at once: the stored setting, within 0..4.
Types
Functions
Applies the stored setting to this node's queue (scale/2 with local_only: true), and says so
in the log when the queue is not in the app's Oban queues. Takes scale/2's :oban.
A node that does not serve the site (MishkaCmsCore.Runtime.Handlers.BootHandler.serving?/0)
sends nothing and leaves its queue as it is: the cards it would draw are the serving node's, and
even a local_only signal reaches every node of the same Oban name.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec config() :: keyword()
@spec enable() :: okey_return() | error_return()
Callback implementation for MishkaInstaller.Event.Hook.enable/0.
@spec get() :: keyword()
Callback implementation for MishkaInstaller.Event.Hook.get/0.
Optional. See MishkaInstaller.Event.Hook.health_check/0. Override to report health.
@spec key() :: String.t()
The setting that says how many share cards are drawn at once.
Optional. See MishkaInstaller.Event.Hook.on_dependency_error/1. Override to react.
@spec queue() :: atom()
The queue every share-card job runs on.
@spec register() :: okey_return() | error_return()
Callback implementation for MishkaInstaller.Event.Hook.register/0.
@spec restart() :: okey_return() | error_return()
Callback implementation for MishkaInstaller.Event.Hook.restart/0.
Draws workers share cards at once: the queue scaled to that many and resumed, or paused for 0.
Options:
:oban— the Oban instance,Obanby default:local_only—truefor this node's queue alone; every node's by default
{:error, :not_running} when that Oban instance is not running, and {:error, :no_queue} for
local_only: true when this node runs no :share_cards queue.
@spec settings() :: [MishkaCmsCore.Settings.definition()]
The setting's definition, on the SEO tab of the settings page.
@spec start() :: okey_return() | error_return()
Callback implementation for MishkaInstaller.Event.Hook.start/0.
@spec stop() :: okey_return() | error_return()
Callback implementation for MishkaInstaller.Event.Hook.stop/0.
@spec unregister() :: okey_return() | error_return()
Callback implementation for MishkaInstaller.Event.Hook.unregister/0.
@spec workers() :: 0..4
How many share cards are drawn at once: the stored setting, within 0..4.