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:
Abin Simon 2023-04-04 21:35:25 +05:30 committed by GitHub
parent ce755ecf3c
commit 4e1a44fbee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 18 deletions

View File

@ -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(

View File

@ -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)
})
}