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. <!-- PR description--> --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [x] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #<issue> #### Test Plan <!-- How will this be tested prior to merging.--> - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
ce755ecf3c
commit
4e1a44fbee
@ -251,11 +251,10 @@ func (col *Collection) streamItems(ctx context.Context, errs *fault.Bus) {
|
|||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
defer func() { <-semaphoreCh }()
|
defer func() { <-semaphoreCh }()
|
||||||
|
|
||||||
item, info, err := getItemWithRetries(
|
item, info, err := col.items.GetItem(
|
||||||
ctx,
|
ctx,
|
||||||
user,
|
user,
|
||||||
id,
|
id,
|
||||||
col.items,
|
|
||||||
fault.New(true)) // temporary way to force a failFast error
|
fault.New(true)) // temporary way to force a failFast error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Don't report errors for deleted items as there's no way for us to
|
// 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()
|
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
|
// terminatePopulateSequence is a utility function used to close a Collection's data channel
|
||||||
// and to send the status update through the channel.
|
// and to send the status update through the channel.
|
||||||
func (col *Collection) finishPopulation(
|
func (col *Collection) finishPopulation(
|
||||||
|
|||||||
@ -228,7 +228,7 @@ func (suite *ExchangeDataCollectionSuite) TestGetItemWithRetries() {
|
|||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
// itemer is mocked, so only the errors are configured atm.
|
// 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)
|
test.expectErr(suite.T(), err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user