activity: when migrating, refresh summaries *once* #3570
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.
Migration logic was calling into
+update-index
for each entry we imported, which in turn calls+refresh-summary
. Of course, we know we'll likely be adding more things, so this is unnecessary (and slow) work.Here, we add an
importing
flag into the context, and set it to true for the duration of migration logic. Theshould-notify
hidden parameter we had added to the+add
arm previously gets replaced by this, and if it's set to true, we don't run+refresh-summary
for every invocation of+update-index
.This brings upgrade wall-clock time down from "idk, didn't finish in a reasonable timeframe" to a minute and a half, of which a full minute is spent on the activity agent's migration logic.
We could probably bring that down further, or at least reduce variance, by capping the amount of events we add per channel. Unclear whether that's desirable or not. The change here feels like 80% of the solution, at least.
Fixes TLON-1986