mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 19:47:21 +01:00
clean up some stuff
This commit is contained in:
parent
17ae9633e8
commit
6d355d9b90
7 changed files with 32 additions and 60 deletions
|
|
@ -13,13 +13,15 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||
private readonly SemaphoreSlim _cacheCreateLock = new(1);
|
||||
private readonly HashSet<ObjectKind> _cachesToCreate = [];
|
||||
private readonly PlayerDataFactory _characterDataFactory;
|
||||
private readonly CancellationTokenSource _runtimeCts = new();
|
||||
private readonly HashSet<ObjectKind> _currentlyCreating = [];
|
||||
private readonly HashSet<ObjectKind> _debouncedObjectCache = [];
|
||||
private readonly CharacterData _playerData = new();
|
||||
private readonly Dictionary<ObjectKind, GameObjectHandler> _playerRelatedObjects = [];
|
||||
private readonly CancellationTokenSource _runtimeCts = new();
|
||||
private CancellationTokenSource _creationCts = new();
|
||||
private CancellationTokenSource _debounceCts = new();
|
||||
private readonly HashSet<ObjectKind> _debouncedObjectCache = [];
|
||||
private bool _isZoning = false;
|
||||
private bool _haltCharaDataCreation;
|
||||
private bool _isZoning = false;
|
||||
|
||||
public CacheCreationService(ILogger<CacheCreationService> logger, MareMediator mediator, GameObjectHandlerFactory gameObjectHandlerFactory,
|
||||
PlayerDataFactory characterDataFactory, DalamudUtilService dalamudUtil) : base(logger, mediator)
|
||||
|
|
@ -103,7 +105,6 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||
{
|
||||
Logger.LogDebug("Received Moodles change, updating player");
|
||||
AddCacheToCreate(ObjectKind.Player);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -153,7 +154,7 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||
_ = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(1), token).ConfigureAwait(false);
|
||||
Logger.LogWarning("Debounce complete, inserting objects to create for: {obj}", string.Join(", ", _debouncedObjectCache));
|
||||
Logger.LogTrace("Debounce complete, inserting objects to create for: {obj}", string.Join(", ", _debouncedObjectCache));
|
||||
await _cacheCreateLock.WaitAsync(token).ConfigureAwait(false);
|
||||
foreach (var item in _debouncedObjectCache)
|
||||
{
|
||||
|
|
@ -164,9 +165,6 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||
});
|
||||
}
|
||||
|
||||
private readonly HashSet<ObjectKind> _currentlyCreating = [];
|
||||
private CancellationTokenSource _creationCts = new();
|
||||
|
||||
private void ProcessCacheCreation()
|
||||
{
|
||||
if (_isZoning || _haltCharaDataCreation) return;
|
||||
|
|
@ -229,4 +227,4 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue