retain map, wait for 5 mins

This commit is contained in:
Abhishek Pandey 2023-08-14 08:43:02 +05:30
parent e67bbac5ed
commit f8af114c13
2 changed files with 10 additions and 2 deletions

View File

@ -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)
}

View File

@ -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)
}