diff --git a/src/internal/connector/exchange_data_collection.go b/src/internal/connector/exchange_data_collection.go index c1959be52..5b3136f6b 100644 --- a/src/internal/connector/exchange_data_collection.go +++ b/src/internal/connector/exchange_data_collection.go @@ -82,10 +82,6 @@ func (edc *ExchangeDataCollection) FinishPopulation() { } } -func (edc *ExchangeDataCollection) Length() int { - return len(edc.data) -} - func (edc *ExchangeDataCollection) Items() <-chan DataStream { return edc.data } diff --git a/src/internal/connector/exchange_data_collection_test.go b/src/internal/connector/exchange_data_collection_test.go index c8b1cb7cf..60ef51c74 100644 --- a/src/internal/connector/exchange_data_collection_test.go +++ b/src/internal/connector/exchange_data_collection_test.go @@ -52,7 +52,6 @@ func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_NewExchange suite.True(Contains(edc.FullPath(), "Directory")) suite.True(Contains(edc.FullPath(), "File")) suite.True(Contains(edc.FullPath(), "task")) - suite.Zero(edc.Length()) } func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_PopulateCollection() { @@ -63,7 +62,7 @@ func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_PopulateCol for i := 0; i < expected; i++ { edc.PopulateCollection(&ExchangeData{id: inputStrings[i*2], message: []byte(inputStrings[i*2+1])}) } - suite.Equal(expected, edc.Length()) + suite.Equal(expected, len(edc.data)) } func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_NextItem() { diff --git a/src/internal/connector/graph_connector.go b/src/internal/connector/graph_connector.go index 7f277b76f..f82b3e810 100644 --- a/src/internal/connector/graph_connector.go +++ b/src/internal/connector/graph_connector.go @@ -347,7 +347,7 @@ func (gc *GraphConnector) serializeMessages(ctx context.Context, user string) (m // populateFromTaskList async call to fill DataCollection via channel implementation func (sc *graphService) populateFromTaskList( - context context.Context, + ctx context.Context, tasklist TaskList, collections map[string]*ExchangeDataCollection, statusChannel chan<- *support.ConnectorOperationStatus, @@ -355,6 +355,7 @@ func (sc *graphService) populateFromTaskList( var errs error var attemptedItems, success int objectWriter := kw.NewJsonSerializationWriter() + //Todo this has to return all the errors in the status for aFolder, tasks := range tasklist { // Get the same folder @@ -373,18 +374,20 @@ func (sc *graphService) populateFromTaskList( errs = support.WrapAndAppend(edc.user, errors.Wrapf(err, "unable to retrieve %s, %s", task, details), errs) continue } - err = messageToDataCollection(&sc.client, context, objectWriter, edc.data, response, edc.user) - + err = messageToDataCollection(&sc.client, ctx, objectWriter, edc.data, response, edc.user) + success++ if err != nil { errs = support.WrapAndAppendf(edc.user, err, errs) + success-- } } + edc.FinishPopulation() attemptedItems += len(tasks) - success += edc.Length() } - status := support.CreateStatus(context, support.Backup, attemptedItems, success, len(tasklist), errs) - logger.Ctx(context).Debug(status.String()) + + status := support.CreateStatus(ctx, support.Backup, attemptedItems, success, len(tasklist), errs) + logger.Ctx(ctx).Debug(status.String()) statusChannel <- status }