New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #22378: Generate policies for campaigns before it starts officially, delete them after it stops (1 hour delay each) #4666
Fixes #22378: Generate policies for campaigns before it starts officially, delete them after it stops (1 hour delay each) #4666
Conversation
@@ -174,14 +174,15 @@ class MainCampaignService(repo: CampaignEventRepository, campaignRepo: CampaignR | |||
event.copy(state = Skipped(s"Event was cancelled because campaign is archived. ${reasonMessage}")) | |||
) | |||
case Enabled => | |||
if (event.start.isAfter(now)) { | |||
val effectiveStart = event.start.minusHours(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make these two time parameter of the MainCampaignService
class so that it remains testable / configurable ?
if (event.start.isAfter(now)) { | ||
val effectiveStart = event.start.minusHours(1) | ||
val effectiveEnd = event.end.plusHours(1) | ||
if (effectiveStart.isAfter(now)) { | ||
for { | ||
// Campaign should be planned, not running | ||
_ <- | ||
CampaignLogger.warn( | ||
s"Campaign event ${event.id.value} was considered Running but we are before it start date, setting state to Schedule and wait for event to start, on ${DateFormaterService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/it start/its start/
for { | ||
// Campaign should be planned, not running | ||
_ <- | ||
CampaignLogger.warn( | ||
s"Campaign event ${event.id.value} was considered Running but we are before it start date, setting state to Schedule and wait for event to start, on ${DateFormaterService | ||
.serialize(event.start)}" | ||
.serialize(effectiveStart)}, one hour before official start date, to ensure policies are correctly dispatched, nothing will be applied on the node" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment will have to be adapted to the param to, something like:
s"Campaign event ${event.id.value} was considered Running but we are before its start date, setting state to
Schedule and wait for event to start, on ${DateFormaterService.serialize(effectiveStart)}, (starting befor official
start date (${event.start}), to ensure policies are correctly dispatched, nothing will be applied on the node)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM to me, can be merged once the comment is addressed
Commit modified |
02e2945
to
fc8fc70
Compare
Commit modified |
fc8fc70
to
f577b99
Compare
…ally, delete them after it stops (1 hour delay each)
Commit modified |
f577b99
to
1e7f91b
Compare
This PR is not mergeable to upper versions. |
OK, merging this PR |
https://issues.rudder.io/issues/22378