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:
parent
27ff840be8
commit
3838258a57
@ -2,6 +2,7 @@ package drive
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"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{
|
uc.idToProps[itemID] = itemProps{
|
||||||
downloadURL: url,
|
downloadURL: strings.Clone(url),
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user