Update retry handling for permissions (#2420)
## Description Previous retry check logic was incorrect and was never retrying. This switches it to using `graph.RunWithRetry`. Sample failures: - https://github.com/alcionai/corso/actions/runs/4109625295/jobs/7091735297 - https://github.com/alcionai/corso/actions/runs/4110739264/jobs/7093919589 ## 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 - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🧹 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
d4abc7f68a
commit
77e9c0fad2
@ -280,7 +280,6 @@ func (oc *Collection) populateItems(ctx context.Context) {
|
|||||||
|
|
||||||
if oc.source == OneDriveSource {
|
if oc.source == OneDriveSource {
|
||||||
// Fetch metadata for the file
|
// Fetch metadata for the file
|
||||||
for i := 1; i <= maxRetries; i++ {
|
|
||||||
if !oc.ctrl.ToggleFeatures.EnablePermissionsBackup {
|
if !oc.ctrl.ToggleFeatures.EnablePermissionsBackup {
|
||||||
// We are still writing the metadata file but with
|
// We are still writing the metadata file but with
|
||||||
// empty permissions as we don't have a way to
|
// empty permissions as we don't have a way to
|
||||||
@ -288,29 +287,18 @@ func (oc *Collection) populateItems(ctx context.Context) {
|
|||||||
// not added.
|
// not added.
|
||||||
itemMeta = io.NopCloser(strings.NewReader("{}"))
|
itemMeta = io.NopCloser(strings.NewReader("{}"))
|
||||||
itemMetaSize = 2
|
itemMetaSize = 2
|
||||||
|
} else {
|
||||||
break
|
err = graph.RunWithRetry(func() error {
|
||||||
}
|
|
||||||
|
|
||||||
itemMeta, itemMetaSize, err = oc.itemMetaReader(ctx, oc.service, oc.driveID, item)
|
itemMeta, itemMetaSize, err = oc.itemMetaReader(ctx, oc.service, oc.driveID, item)
|
||||||
|
return err
|
||||||
// retry on Timeout type errors, break otherwise.
|
})
|
||||||
if err == nil ||
|
|
||||||
!graph.IsErrTimeout(err) ||
|
|
||||||
!graph.IsInternalServerError(err) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if i < maxRetries {
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errUpdater(*item.GetId(), errors.Wrap(err, "failed to get item permissions"))
|
errUpdater(*item.GetId(), errors.Wrap(err, "failed to get item permissions"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch oc.source {
|
switch oc.source {
|
||||||
case SharePointSource:
|
case SharePointSource:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user