fix: only send sensor start event on first poke #700
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Is your feature request related to a problem? Please describe.
The existing sensor metric "sensor_start_event" call back gets invoked on every sensor poke.
This results in redundant database calls on optimus server. To overcome this we need to have some sort of stateful storage that can limit the "sensor_start_event" to only once per sensor attempt.
Describe the solution you'd like
It's ideal to use the XCOMs as a state storage for maintaining the record of events pushed per sensor attempt.
Before pushing the event to optimus the scheduler can check if a start event has already been sent
Describe alternatives you've considered