# `MishkaCmsCore.Runtime.Workers.ShareCardPlanWorker`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/workers/share_card_plan_worker.ex#L5)

Collects every share card of a site and queues a look at each: the planner
`MishkaCmsCore.Runtime.ShareCard.redraw_all/2` enqueues, on `:share_cards`.

It asks the producers for their cards through `MishkaCmsCore.Runtime.ShareCard.targets/2`, then
inserts, in batches of 500:

  * a `MishkaCmsCore.Runtime.Workers.ShareCardRefreshWorker` job for each `{:page, id}` and
    `{:record, kind, captures}`, with the planner's `force`;
  * each `Oban.Job` changeset a producer answered with, as it is — one on another queue than
    `:share_cards` is left out.

Asked for every producer's cards, it then queues a
`MishkaCmsCore.Runtime.Workers.ShareCardSweepWorker`, which deletes the card files none of those
looks showed once they have run. A target two producers name is looked at once. While the targets event cannot run — one of its
plugins is started but not loaded — the planner waits 30 seconds and asks again.

One planner a site, `force` and `producer` waits at a time: a second request while one waits is
that one. Once its looks are queued it broadcasts
`{:share_cards_planned, %{site_id:, force:, producer:, counts: %{producer => looks}}}` on
`planned_topic/0` of `MishkaCmsCore.PubSub`.

# `planned_topic`

```elixir
@spec planned_topic() :: String.t()
```

The PubSub topic a planner says on how many looks it queued.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
