feat: read backup file and bootstrap for streaming#255
Conversation
Pull Request Test Coverage Report for Build 17298764007Details
💛 - Coveralls |
| require 'json' | ||
|
|
||
| module Unleash | ||
| class BackupFileReader |
There was a problem hiding this comment.
this is extracted from toggle_fetcher
| self.event_processor = Unleash::StreamingEventProcessor.new(engine) | ||
| self.running = false | ||
|
|
||
| begin |
There was a problem hiding this comment.
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
sighphyre
left a comment
There was a problem hiding this comment.
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.
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.
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 |
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