correct count of successful status items (#366)
* correct count of successful status items
This commit is contained in:
parent
6c22d5c0ce
commit
6d04c82992
@ -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
|
||||
}
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user