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 {
|
func (edc *ExchangeDataCollection) Items() <-chan DataStream {
|
||||||
return edc.data
|
return edc.data
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,6 @@ func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_NewExchange
|
|||||||
suite.True(Contains(edc.FullPath(), "Directory"))
|
suite.True(Contains(edc.FullPath(), "Directory"))
|
||||||
suite.True(Contains(edc.FullPath(), "File"))
|
suite.True(Contains(edc.FullPath(), "File"))
|
||||||
suite.True(Contains(edc.FullPath(), "task"))
|
suite.True(Contains(edc.FullPath(), "task"))
|
||||||
suite.Zero(edc.Length())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_PopulateCollection() {
|
func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_PopulateCollection() {
|
||||||
@ -63,7 +62,7 @@ func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_PopulateCol
|
|||||||
for i := 0; i < expected; i++ {
|
for i := 0; i < expected; i++ {
|
||||||
edc.PopulateCollection(&ExchangeData{id: inputStrings[i*2], message: []byte(inputStrings[i*2+1])})
|
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() {
|
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
|
// populateFromTaskList async call to fill DataCollection via channel implementation
|
||||||
func (sc *graphService) populateFromTaskList(
|
func (sc *graphService) populateFromTaskList(
|
||||||
context context.Context,
|
ctx context.Context,
|
||||||
tasklist TaskList,
|
tasklist TaskList,
|
||||||
collections map[string]*ExchangeDataCollection,
|
collections map[string]*ExchangeDataCollection,
|
||||||
statusChannel chan<- *support.ConnectorOperationStatus,
|
statusChannel chan<- *support.ConnectorOperationStatus,
|
||||||
@ -355,6 +355,7 @@ func (sc *graphService) populateFromTaskList(
|
|||||||
var errs error
|
var errs error
|
||||||
var attemptedItems, success int
|
var attemptedItems, success int
|
||||||
objectWriter := kw.NewJsonSerializationWriter()
|
objectWriter := kw.NewJsonSerializationWriter()
|
||||||
|
|
||||||
//Todo this has to return all the errors in the status
|
//Todo this has to return all the errors in the status
|
||||||
for aFolder, tasks := range tasklist {
|
for aFolder, tasks := range tasklist {
|
||||||
// Get the same folder
|
// 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)
|
errs = support.WrapAndAppend(edc.user, errors.Wrapf(err, "unable to retrieve %s, %s", task, details), errs)
|
||||||
continue
|
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 {
|
if err != nil {
|
||||||
errs = support.WrapAndAppendf(edc.user, err, errs)
|
errs = support.WrapAndAppendf(edc.user, err, errs)
|
||||||
|
success--
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
edc.FinishPopulation()
|
edc.FinishPopulation()
|
||||||
attemptedItems += len(tasks)
|
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
|
statusChannel <- status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user