feat(PredictionsPubSub): immediately broadcast resets #1796
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.
Summary of changes
Asana Ticket: Stop page loads predictions and schedules slowly (Predictions)
By adding immediate broadcasting of the
:reset
events coming from the predictions stream, I was able to decrease the time-to-first-predictions on the Haymarket page in Chrome desktop from 11145 ms to 715 ms (-93.6%). (This was measured usingconsole.time
andconsole.timeEnd
on the predictions being output from theusePredictionsChannel
hook). Similar decreases were seen at other stops.My understanding is that reset events are generally the first event after subscribing to a stream, though they can happen at other points during the stream as well. :) So that seemed like a reasonable place to immediately send the predictions to subscribing channels etc.