MishkaCmsCore.Runtime.Workers.ShareCardSweepWorker (Mishka CMS Core v0.0.1)

Copy Markdown View Source

Deletes the share cards of a site that no page shows any more: the planner (MishkaCmsCore.Runtime.Workers.ShareCardPlanWorker) queues one, on :share_cards, after it has queued a look at every card of the site, with the time it started as since.

Every look marks the card files its pages show (MishkaCmsCore.Runtime.ShareCard.keep/2), and a card drawn by a look is written after since. So once the looks have run, a file in the site's share folder (MishkaCmsCore.Runtime.ShareCard.dir/1) last written before since is one no page names: a card drawn for data that has changed since. Those are deleted, with any .part file a drawing left behind before since.

It runs after the looks: at the lowest priority, so every job of the queue that is waiting — the looks, and each drawing they queue — goes first, and while another job of the queue is running on this node it waits 15 seconds and looks again. One sweep a site waits at a time.

The names deleted are announced on MishkaCmsCore.Runtime.ShareCard.swept_event/0, and the core forgets the ones it remembered as drawn, so a page that asks for one again has it drawn again.

Summary

Functions

The sweep of the site site_id that follows a look at every card of it begun at since, a Unix time in seconds.

Functions

after_plan(site_id, since)

@spec after_plan(String.t(), integer()) :: Ecto.Changeset.t()

The sweep of the site site_id that follows a look at every card of it begun at since, a Unix time in seconds.