mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Maybe sort race condition.
This commit is contained in:
parent
a38a989fe7
commit
ee50994b39
5 changed files with 11 additions and 6 deletions
|
|
@ -42,6 +42,8 @@ public class CollectionCacheManager : IDisposable
|
||||||
_active = active;
|
_active = active;
|
||||||
_storage = storage;
|
_storage = storage;
|
||||||
|
|
||||||
|
if (!_active.Individuals.IsLoaded)
|
||||||
|
_active.Individuals.Loaded += CreateNecessaryCaches;
|
||||||
_communicator.CollectionChange.Subscribe(OnCollectionChange, -100);
|
_communicator.CollectionChange.Subscribe(OnCollectionChange, -100);
|
||||||
_communicator.ModPathChanged.Subscribe(OnModChangeAddition, -100);
|
_communicator.ModPathChanged.Subscribe(OnModChangeAddition, -100);
|
||||||
_communicator.ModPathChanged.Subscribe(OnModChangeRemoval, 100);
|
_communicator.ModPathChanged.Subscribe(OnModChangeRemoval, 100);
|
||||||
|
|
@ -49,11 +51,11 @@ public class CollectionCacheManager : IDisposable
|
||||||
_communicator.ModOptionChanged.Subscribe(OnModOptionChange, -100);
|
_communicator.ModOptionChanged.Subscribe(OnModOptionChange, -100);
|
||||||
_communicator.ModSettingChanged.Subscribe(OnModSettingChange);
|
_communicator.ModSettingChanged.Subscribe(OnModSettingChange);
|
||||||
_communicator.CollectionInheritanceChanged.Subscribe(OnCollectionInheritanceChange);
|
_communicator.CollectionInheritanceChanged.Subscribe(OnCollectionInheritanceChange);
|
||||||
CreateNecessaryCaches();
|
|
||||||
_active.Individuals.Loaded += CreateNecessaryCaches;
|
|
||||||
|
|
||||||
if (!MetaFileManager.CharacterUtility.Ready)
|
if (!MetaFileManager.CharacterUtility.Ready)
|
||||||
MetaFileManager.CharacterUtility.LoadingFinished += IncrementCounters;
|
MetaFileManager.CharacterUtility.LoadingFinished += IncrementCounters;
|
||||||
|
|
||||||
|
CreateNecessaryCaches();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
@ -303,6 +305,7 @@ public class CollectionCacheManager : IDisposable
|
||||||
.Select(c => Task.Run(() => CalculateEffectiveFileListInternal(c)))
|
.Select(c => Task.Run(() => CalculateEffectiveFileListInternal(c)))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
Penumbra.Log.Debug($"Creating {tasks.Length} necessary caches.");
|
||||||
Task.WaitAll(tasks);
|
Task.WaitAll(tasks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class ActiveCollections : ISavable, IDisposable
|
||||||
Current = storage.DefaultNamed;
|
Current = storage.DefaultNamed;
|
||||||
Default = storage.DefaultNamed;
|
Default = storage.DefaultNamed;
|
||||||
Interface = storage.DefaultNamed;
|
Interface = storage.DefaultNamed;
|
||||||
Individuals = new IndividualCollections(actors, config);
|
Individuals = new IndividualCollections(actors, config, false);
|
||||||
_communicator.CollectionChange.Subscribe(OnCollectionChange, -100);
|
_communicator.CollectionChange.Subscribe(OnCollectionChange, -100);
|
||||||
LoadCollections();
|
LoadCollections();
|
||||||
UpdateCurrentCollectionInUse();
|
UpdateCurrentCollectionInUse();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Dalamud.Game;
|
|
||||||
using Dalamud.Game.ClientState.Objects.Enums;
|
using Dalamud.Game.ClientState.Objects.Enums;
|
||||||
using Dalamud.Interface.Internal.Notifications;
|
using Dalamud.Interface.Internal.Notifications;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
@ -37,6 +36,7 @@ public partial class IndividualCollections
|
||||||
{
|
{
|
||||||
if (ReadJObjectInternal(obj, storage))
|
if (ReadJObjectInternal(obj, storage))
|
||||||
saver.ImmediateSave(parent);
|
saver.ImmediateSave(parent);
|
||||||
|
IsLoaded = true;
|
||||||
Loaded.Invoke();
|
Loaded.Invoke();
|
||||||
_actorService.FinishedCreation -= Func;
|
_actorService.FinishedCreation -= Func;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,16 @@ public sealed partial class IndividualCollections
|
||||||
private readonly Dictionary<ActorIdentifier, ModCollection> _individuals = new();
|
private readonly Dictionary<ActorIdentifier, ModCollection> _individuals = new();
|
||||||
|
|
||||||
public event Action Loaded;
|
public event Action Loaded;
|
||||||
|
public bool IsLoaded { get; private set; }
|
||||||
|
|
||||||
public IReadOnlyList<(string DisplayName, IReadOnlyList<ActorIdentifier> Identifiers, ModCollection Collection)> Assignments
|
public IReadOnlyList<(string DisplayName, IReadOnlyList<ActorIdentifier> Identifiers, ModCollection Collection)> Assignments
|
||||||
=> _assignments;
|
=> _assignments;
|
||||||
|
|
||||||
public IndividualCollections(ActorService actorService, Configuration config)
|
public IndividualCollections(ActorService actorService, Configuration config, bool temporary)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_actorService = actorService;
|
_actorService = actorService;
|
||||||
|
IsLoaded = temporary;
|
||||||
Loaded += () => Penumbra.Log.Information($"{_assignments.Count} Individual Assignments loaded after delay.");
|
Loaded += () => Penumbra.Log.Information($"{_assignments.Count} Individual Assignments loaded after delay.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public class TempCollectionManager : IDisposable
|
||||||
_communicator = communicator;
|
_communicator = communicator;
|
||||||
_actors = actors;
|
_actors = actors;
|
||||||
_storage = storage;
|
_storage = storage;
|
||||||
Collections = new IndividualCollections(actors, config);
|
Collections = new IndividualCollections(actors, config, true);
|
||||||
|
|
||||||
_communicator.TemporaryGlobalModChange.Subscribe(OnGlobalModChange);
|
_communicator.TemporaryGlobalModChange.Subscribe(OnGlobalModChange);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue