-
Notifications
You must be signed in to change notification settings - Fork 43
feat: read backup file and bootstrap for streaming #255
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
Conversation
Pull Request Test Coverage Report for Build 17298764007Details
💛 - Coveralls |
require 'json' | ||
|
||
module Unleash | ||
class BackupFileReader |
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.
this is extracted from toggle_fetcher
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.
Nice, I really like this
self.event_processor = Unleash::StreamingEventProcessor.new(engine) | ||
self.running = false | ||
|
||
begin |
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.
this was missing
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.
similar setup to toggle fetcher in polling mode but we don't make first request to the server and instead go straight to either bootstrap or a backup file. Then streaming starts and takes over from there
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.
Nice, I like the harvested backup file reader!
lib/unleash/backup_file_reader.rb
Outdated
Unleash.logger.error "Unable to read the backup_file: #{e}" | ||
# :nocov: | ||
nil | ||
rescue JSON::ParserError => e |
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.
I actually don't think this case can happen since we no longer parse on read. I realise this is a hangover from the old implementation (my bad, should have dropped this when I ported to Ygg). If we don't remove it in this PR, no biggie, I'll do it in a future one
read_backup_file!(engine) | ||
end | ||
rescue StandardError => e | ||
# fail back to reading the backup file |
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.
Also a hangover from the old code haha, but may as well fix it while we're here
# fail back to reading the backup file | |
# fall back to reading the backup file |
require 'json' | ||
|
||
module Unleash | ||
class BackupFileReader |
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.
Nice, I really like this
About the changes
Important files
Discussion points
We may consider reading backup file outside of the fetcher/streamer if we change current architecture a bit