From 84e90b3baa1c99151366de861fdca5dfeca2cf32 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 21 Dec 2023 13:43:21 +1300 Subject: [PATCH] batch size as 1000 --- .../20231128_jellyfish_migration.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/migrations/20231128_jellyfish_migration/20231128_jellyfish_migration.go b/migrations/20231128_jellyfish_migration/20231128_jellyfish_migration.go index b3b1eccad..baed77ef7 100644 --- a/migrations/20231128_jellyfish_migration/20231128_jellyfish_migration.go +++ b/migrations/20231128_jellyfish_migration/20231128_jellyfish_migration.go @@ -381,15 +381,17 @@ func (m *Migration) fetchAndUpdateBatch() bool { m.updates = []mongo.WriteModel{} + size := int32(1000) + if dataC := m.getDataCollection(); dataC != nil { fetchStart := time.Now() dDataCursor, err := dataC.Find(m.ctx, selector, &options.FindOptions{ - Limit: &m.config.readBatchSize, - Sort: bson.M{"_id": 1}, + Limit: &m.config.readBatchSize, + Sort: bson.M{"_id": 1}, + BatchSize: &size, }, ) - dDataCursor.SetBatchSize(1000) if err != nil { log.Printf("failed to select data: %s", err)