From 4e1a44fbee64f60149a9926fe4fbd37957b3c7e1 Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Tue, 4 Apr 2023 21:35:25 +0530 Subject: [PATCH] Remove unnecessary indirection for retries (#3021) This was previously used to add retry logic which is no more the case as is a completely unnecessary indirection. --- #### Does this PR need a docs update or release note? - [ ] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [x] :no_entry: No #### Type of change - [ ] :sunflower: Feature - [ ] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Supportability/Tests - [ ] :computer: CI/Deployment - [x] :broom: Tech Debt/Cleanup #### Issue(s) * # #### Test Plan - [x] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- .../exchange/exchange_data_collection.go | 18 +----------------- .../exchange/exchange_data_collection_test.go | 2 +- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/internal/connector/exchange/exchange_data_collection.go b/src/internal/connector/exchange/exchange_data_collection.go index d8e1cc2e7..66d891b28 100644 --- a/src/internal/connector/exchange/exchange_data_collection.go +++ b/src/internal/connector/exchange/exchange_data_collection.go @@ -251,11 +251,10 @@ func (col *Collection) streamItems(ctx context.Context, errs *fault.Bus) { defer wg.Done() defer func() { <-semaphoreCh }() - item, info, err := getItemWithRetries( + item, info, err := col.items.GetItem( ctx, user, id, - col.items, fault.New(true)) // temporary way to force a failFast error if err != nil { // Don't report errors for deleted items as there's no way for us to @@ -300,21 +299,6 @@ func (col *Collection) streamItems(ctx context.Context, errs *fault.Bus) { wg.Wait() } -// get an item while handling retry and backoff. -func getItemWithRetries( - ctx context.Context, - userID, itemID string, - items itemer, - errs *fault.Bus, -) (serialization.Parsable, *details.ExchangeInfo, error) { - item, info, err := items.GetItem(ctx, userID, itemID, errs) - if err != nil { - return nil, nil, err - } - - return item, info, nil -} - // terminatePopulateSequence is a utility function used to close a Collection's data channel // and to send the status update through the channel. func (col *Collection) finishPopulation( diff --git a/src/internal/connector/exchange/exchange_data_collection_test.go b/src/internal/connector/exchange/exchange_data_collection_test.go index 4df0bbb87..2abb08bb6 100644 --- a/src/internal/connector/exchange/exchange_data_collection_test.go +++ b/src/internal/connector/exchange/exchange_data_collection_test.go @@ -228,7 +228,7 @@ func (suite *ExchangeDataCollectionSuite) TestGetItemWithRetries() { defer flush() // itemer is mocked, so only the errors are configured atm. - _, _, err := getItemWithRetries(ctx, "userID", "itemID", test.items, fault.New(true)) + _, _, err := test.items.GetItem(ctx, "userID", "itemID", fault.New(true)) test.expectErr(suite.T(), err) }) }