insights: More robust find-and-replace for series_ids in oob settings migration
Created by: CristinaBirkel
This does two things:
- If the find-and-replace in
updateTimeSeriesReferences
makes 0 updates, we do NOT stamp thebackfill_queued_at
so that it has a chance to calculate the points. I don't expect this case to happen, but we saw something like this happen onk8s
so this is a guard against it. - Now it also does a find-and-replace on the
insights_query_runner_jobs.series_id
field as well. This is to handle a case where series points are being calculated when the migration is running; if we didn't do this, the series points would continue to be calculated with the oldseries_id
and never included on the chart.
The if statements got a bit nested, but I think it makes enough sense for temporary code. Also let me know if you see any issues with the workerStore
being included like that. It's not all part of the same transaction, but it's in a different database so I don't think there's much we can do about that.