Page MenuHomePhabricator
Paste P22017

UML activity diagram: banner service, part 1
ActivePublic

Authored by AndyRussG on Mar 8 2022, 2:49 AM.
Tags
None
Referenced Files
F34983535: UML activity diagram: banner service, part 1
Mar 8 2022, 2:49 AM
Subscribers
None
@startuml
scale 1.2
title Banner service (part 1)
start
:Check status;
if (Kill switch activated?) then (no)
else (yes)
:Return static HTML string with no banner and flag
for JavaScript post-processing;
stop
endif
:Load/parse/access inputs:
* Active CentralNotice campaign amd banner config, from in-memory cache
* Targeting data from Varnish
* Client data from cookies
* Static config;
:Hash pageview-specific inputs;
:Check in-memory cache of deterministic banner selections;
note right
This cache would store banner selections that did not
involve any random decisions. Cache keys would be
hashes of pageview-specific inputs. The cache would
be cleared whenever CentralNotice campaign config
changes.
end note
if (
Did we previously run a selection process deterministically using the same inputs?
) then (yes)
if (
Did that deterministic process select a banner?
) then (yes)
(A)
detach
else (no)
(B)
detach
endif
else (no)
endif
partition #lightgray "Find campaigns available for this pageview" {
while (Are there campaings in CN config that we haven't processed yet?)
->yes;
:Begin processing a campaign from CN config;
if (
Is the campaign available for this location, device, language,
logged-in status and project?
) then (yes)
if (
Can the campaign be shown to this client, based on client data from cookies?
) then (yes)
:Add the campaign to the list of available campaigns to show;
else (no)
endif
else (no)
endif
endwhile (no)
}
partition #lightgray "Possibly select a campaign" {
if (
Are there any available campaigns to show?
) then (no)
:Record the lack of any available campaigns in in-memory
cache of deterministic banner selections.;
(B)
detach
endif
:Calculate the desired probability of selection for each available campaign ("allocation").;
if (
Is there a single campaign we should select with a probability of 100%?
) then (no)
:Roll the dice to possibly select a campaign.;
if (
Was a campaign selected?
) then (no)
(B)
detach
else (yes)
endif
else (yes)
endif
:Campaign selected;
}
(C)
@enduml