Proca.Server.Stats (proca v3.3.1)
Stores campaign and action page signature counts in following structure (under campaign state key):
- map of campaign ids stores 2 element tuple
- first element is count for whole campaign
- second element is a keylist mapping action_type to count
extra_supporters are included in supoorters count
TODO: how to add extra_supporters to areas?
State structure:
interval: int - calculation interval in ms query_runs: boolean - a flag saying calculation is running now and we shouldn't run new calculation campaign: campaign_id -> (map) {deduped supporters, %{action_type: count}, %{area: count}, %{org_id: count}}
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
- Get stats for campaign
- Get stats for action types
Every @sync_every_ms ms we send to ourselves a :sync message, to synchronize counts from DB.
Link to this section Functions
calculate()
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
handle_call(msg, arg2, state)
- Get stats for campaign
- Get stats for action types
handle_info(msg, state)
Every @sync_every_ms ms we send to ourselves a :sync message, to synchronize counts from DB.