Return an error when adding the same asset label multiple times.#19485
Return an error when adding the same asset label multiple times.#19485andriyDev wants to merge 6 commits intobevyengine:mainfrom
Conversation
…et name (since their paths are different).
32f14fd to
b80279e
Compare
alice-i-cecile
left a comment
There was a problem hiding this comment.
Helpful fix, but the Mutex makes me nervous. Can you see any other viable solutions?
|
@alice-i-cecile Not really. The problem is that we need to be able to differentiate between immediate nested asset loads and their subassets, from "root asset" subassets. This was the thing I missed in #15481, and not something that's easy to fix without gross hacks. This solution has the advantage that as soon as you add a duplicate subasset, you'll get the feedback. I don't think we need to worry much about the Mutex. It's got quite a small critical section, and likely has very low contention (people are probably not adding many subassets from many threads), plus asset loading in general is IO-bound. |
b80279e to
544f418
Compare
alice-i-cecile
left a comment
There was a problem hiding this comment.
Awesome, thanks for the justification :)
Objective
LoadContextdoes not return an error. #19026.Solution
LoadContextbe a&Mutex<HashMap>.LoadContexts for subassets reuse the same&Mutex<HashMap>.Mutex<HashMap>, so their subassets will be managed separately.Testing