Remove graph sdk store references in url cache item map (#4800)

<!-- PR description-->

Use `Clone()` on item properties so that we don't hold on to graph in-memory store references.

---

#### 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:
Abhishek Pandey 2023-12-06 17:10:55 -08:00 committed by GitHub
parent 27ff840be8
commit 3838258a57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ package drive
import (
"context"
"strings"
"sync"
"time"
@ -250,10 +251,13 @@ func (uc *urlCache) updateCache(
}
}
itemID := ptr.Val(item.GetId())
// Deep copy the item ID and download url so that we don't hold on to
// references to these strings in graph in-memory stores, which can
// take up more memory than necessary.
itemID := strings.Clone(ptr.Val(item.GetId()))
uc.idToProps[itemID] = itemProps{
downloadURL: url,
downloadURL: strings.Clone(url),
isDeleted: false,
}