Only prepare group members for migration just before the migration.
This commit is contained in:
parent
43944545b6
commit
11368d5b28
@ -171,7 +171,7 @@ class TestingViewController: OWSTableViewController {
|
||||
let section = OWSTableSection()
|
||||
section.footerTitle = LocalizationNotNeeded("Make sure to force-enable auto-migrations above first.")
|
||||
section.add(OWSTableItem.actionItem(withText: LocalizationNotNeeded("Groups v2: Auto-migrate all v1 groups")) {
|
||||
GroupsV2Migration.tryToAutoMigrateAllGroups()
|
||||
GroupsV2Migration.tryToAutoMigrateAllGroups(shouldLimitBatchSize: false)
|
||||
})
|
||||
contents.addSection(section)
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ public class GroupsV2Impl: NSObject, GroupsV2Swift {
|
||||
|
||||
Self.enqueueRestoreGroupPass()
|
||||
|
||||
GroupsV2Migration.tryToAutoMigrateAllGroups()
|
||||
GroupsV2Migration.tryToAutoMigrateAllGroups(shouldLimitBatchSize: true)
|
||||
}
|
||||
|
||||
observeNotifications()
|
||||
|
||||
@ -160,7 +160,7 @@ public extension GroupsV2Migration {
|
||||
return true
|
||||
}
|
||||
|
||||
static func tryToAutoMigrateAllGroups() {
|
||||
static func tryToAutoMigrateAllGroups(shouldLimitBatchSize: Bool) {
|
||||
AssertIsOnMainThread()
|
||||
|
||||
guard FeatureFlags.groupsV2Migrations else {
|
||||
@ -211,7 +211,7 @@ public extension GroupsV2Migration {
|
||||
|
||||
// Check up to N groups on every launch.
|
||||
let maxCheckCount: Int = 50
|
||||
if groupThreads.count > maxCheckCount {
|
||||
if shouldLimitBatchSize, groupThreads.count > maxCheckCount {
|
||||
groupThreads.shuffle()
|
||||
groupThreads = Array(groupThreads.prefix(upTo: maxCheckCount))
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user