Move Creation of Caches to constructor thread.

This commit is contained in:
Ottermandias 2023-05-05 16:17:25 +02:00
parent e5c4743374
commit 6f6b72e7aa
4 changed files with 4 additions and 5 deletions

View file

@ -57,8 +57,6 @@ public class CollectionCacheManager : IDisposable
if (!MetaFileManager.CharacterUtility.Ready)
MetaFileManager.CharacterUtility.LoadingFinished += IncrementCounters;
CreateNecessaryCaches();
}
public void Dispose()
@ -305,7 +303,7 @@ public class CollectionCacheManager : IDisposable
/// Cache handling. Usually recreate caches on the next framework tick,
/// but at launch create all of them at once.
/// </summary>
private void CreateNecessaryCaches()
public void CreateNecessaryCaches()
{
var tasks = _active.SpecialAssignments.Select(p => p.Value)
.Concat(_active.Individuals.Select(p => p.Collection))

View file

@ -49,7 +49,7 @@ public class Penumbra : IDalamudPlugin
public Penumbra(DalamudPluginInterface pluginInterface)
{
try
{
{
var startTimer = new StartTracker();
using var timer = startTimer.Measure(StartTimeType.Total);
_services = ServiceManager.CreateProvider(this, pluginInterface, Log, startTimer);
@ -67,7 +67,8 @@ public class Penumbra : IDalamudPlugin
_redrawService = _services.GetRequiredService<RedrawService>();
_communicatorService = _services.GetRequiredService<CommunicatorService>();
_services.GetRequiredService<ResourceService>(); // Initialize because not required anywhere else.
_services.GetRequiredService<ModCacheManager>(); // Initialize because not required anywhere else.
_services.GetRequiredService<ModCacheManager>(); // Initialize because not required anywhere else.
_collectionManager.Caches.CreateNecessaryCaches();
using (var t = _services.GetRequiredService<StartTracker>().Measure(StartTimeType.PathResolver))
{
_services.GetRequiredService<PathResolver>();