-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add maintenance window logic #115
Conversation
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.
See comments in code on suggestions for implementation.
lib/dfe/analytics/send_events.rb
Outdated
if DfE::Analytics.within_maintenance_window? | ||
# Delaying / Queueing events - the redis bit | ||
Rails.logger.info('Within BigQuery maintenance window. Events will be queued for later processing.') | ||
return | ||
end | ||
|
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.
Need to remove this block here and move into the do
method above.
if DfE::Analytics.within_maintenance_window? | |
# Delaying / Queueing events - the redis bit | |
Rails.logger.info('Within BigQuery maintenance window. Events will be queued for later processing.') | |
return | |
end |
In the do
method replace lines 13-17 with the following:
if DfE::Analytics.within_maintenance_window?
set(wait_until: DfE::Analytics.next_scheduled_time_after_maintenance_window).perform_later(events)
elsif DfE::Analytics.async?
perform_later(events)
else
perform_now(events)
end
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.
Looks good @ericaporter - Just have a minor comment about adding another test.
Relating to this ticket
We need the ability to do maintenance on on a live streamed BiqQuery dataset, such as register_events_production.
This PR adds a configuration item for a maintenance window.
Redis logic - WIP
end_timestamp + number of seconds elapsed since start_timestamp
The queued items will end up queued in Redis.