Skip item if metadata fetch fails with 404 (#4001)
<!-- PR description--> GET permissions fails if the item doesn't exist. We are hitting sanity test failures due to a race condition between test run & purge scripts. `getting item metadata: getting item metadata: error status code received from the API: Item not found:` Fix here is to ignore GET permissions failure if it returns not found. This is safe to do here, since the graph call for permissions [looks up the item by id](https://github.com/alcionai/corso/blob/main/src/pkg/services/m365/api/drive.go#L254C17-L254C17), and not the permissions by id. Hence, we can safely assume that the item that this permission is tied to has been deleted. --- #### 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 - [ ] 🤖 Supportability/Tests - [ ] 💻 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. --> * https://github.com/alcionai/corso/issues/3998 #### Test Plan <!-- How will this be tested prior to merging.--> - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
9ce6b9c5c1
commit
bffaebd351
@ -512,10 +512,14 @@ func (oc *Collection) populateDriveItem(
|
|||||||
metaSuffix = metadata.DirMetaFileSuffix
|
metaSuffix = metadata.DirMetaFileSuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch metadata for the file
|
// Fetch metadata for the item
|
||||||
itemMeta, itemMetaSize, err = downloadItemMeta(ctx, oc.handler, oc.driveID, item)
|
itemMeta, itemMetaSize, err = downloadItemMeta(ctx, oc.handler, oc.driveID, item)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs.AddRecoverable(ctx, clues.Wrap(err, "getting item metadata").Label(fault.LabelForceNoBackupCreation))
|
// Skip deleted items
|
||||||
|
if !clues.HasLabel(err, graph.LabelStatus(http.StatusNotFound)) && !graph.IsErrDeletedInFlight(err) {
|
||||||
|
errs.AddRecoverable(ctx, clues.Wrap(err, "getting item metadata").Label(fault.LabelForceNoBackupCreation))
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -255,7 +255,7 @@ func (c Drives) GetItemPermission(
|
|||||||
Permissions().
|
Permissions().
|
||||||
Get(ctx, nil)
|
Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, graph.Wrap(ctx, err, "getting item metadata").With("item_id", itemID)
|
return nil, graph.Wrap(ctx, err, "getting item permission").With("item_id", itemID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return perm, nil
|
return perm, nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user