From f8af114c13bf9ad0abd6811123959b4068b8a83c Mon Sep 17 00:00:00 2001 From: Abhishek Pandey Date: Mon, 14 Aug 2023 08:43:02 +0530 Subject: [PATCH] retain map, wait for 5 mins --- src/internal/m365/collection/drive/collection.go | 7 ++++++- src/internal/operations/backup.go | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/internal/m365/collection/drive/collection.go b/src/internal/m365/collection/drive/collection.go index fd9620fb3..3f1bc0edc 100644 --- a/src/internal/m365/collection/drive/collection.go +++ b/src/internal/m365/collection/drive/collection.go @@ -8,6 +8,7 @@ import ( "sync" "sync/atomic" "time" + "unsafe" "github.com/alcionai/clues" "github.com/microsoftgraph/msgraph-sdk-go/models" @@ -467,8 +468,12 @@ func (oc *Collection) populateItems(ctx context.Context, errs *fault.Bus) { wg.Wait() + // print memory for oc.DriveItems + size := unsafe.Sizeof(oc.driveItems) + logger.Ctx(ctx).Infow("driveItems map size", "size", size) + // free up memory - oc.driveItems = make(map[string]models.DriveItemable) + //oc.driveItems = make(map[string]models.DriveItemable) oc.reportAsCompleted(ctx, int(stats.itemsFound), int(stats.itemsRead), stats.byteCount) } diff --git a/src/internal/operations/backup.go b/src/internal/operations/backup.go index dc1798441..1dcbcfdf4 100644 --- a/src/internal/operations/backup.go +++ b/src/internal/operations/backup.go @@ -373,7 +373,7 @@ func (op *BackupOperation) do( cs := []data.BackupCollection{} canUsePreviousBackup := false - var maxCount int = 5 + var maxCount int = 2 for i := 0; i < maxCount; i++ { logger.Ctx(ctx).Info("delta query iteration") @@ -396,6 +396,9 @@ func (op *BackupOperation) do( "can_use_previous_backup", canUsePreviousBackup, "collection_count", len(cs)) + // sleep for 5 mins + time.Sleep(5 * time.Minute) + if i == maxCount-1 { return nil, clues.New("unable to produce backup collections").WithClues(ctx) }