AgentRepositoryImpl.cachedAgents and PresetRepositoryImpl.cachedPresets are read-checked, fetched across a suspension point, then written. With @Volatile alone, two coroutines can both observe null, both issue the network request, and both write the cache — a redundant API call per cold-cache race. Wrap read-check-write in a Mutex so at most one fetch runs per cold cache; invalidateCache() becomes suspend to match. |
||
|---|---|---|
| .. | ||
| common | ||
| data | ||
| model | ||
| network | ||
| ui | ||