Update MigrateRecordsToGhostUserInBatchesService retry logic to prevent from being blocked at one user
As an additional update from the issue, we can update the retry logic for MigrateRecordsToGhostUserInBatchesService
by story a retry attribute for each row/user to avoid getting blocked if that deletion fails for a reasons. @ahegyi recommended:
We can use the same pattern that we have for loose foreign keys.
- Add the
consume_after
column to theghost_user_migrations
table. - Set the
consume_after
value tocreated_at
by default (could beNOW()
as well) when theghost_user_migrations
record is created. - When a user deletion fails, catch the timeout error and update the
consume_after
withTime.current + 30 minutes
.
Additionally, we should retrieve a batch by ordering the rows by consume_after ASC