Run some timers a little faster

This commit is contained in:
Loporrit
2025-05-14 10:13:49 +00:00
parent 4dd34039f4
commit e2e59bd396
4 changed files with 20 additions and 14 deletions

View File

@@ -44,15 +44,21 @@ public sealed partial class IpcManager : DisposableMediatorSubscriberBase
public IpcCallerPetNames PetNames { get; } public IpcCallerPetNames PetNames { get; }
public IpcCallerMoodles Moodles { get; } public IpcCallerMoodles Moodles { get; }
private int _stateCheckCounter = -1;
private void PeriodicApiStateCheck() private void PeriodicApiStateCheck()
{ {
Penumbra.CheckAPI(); // Stagger API checks
Penumbra.CheckModDirectory(); if (++_stateCheckCounter > 7)
Glamourer.CheckAPI(); _stateCheckCounter = 0;
Heels.CheckAPI(); int i = _stateCheckCounter;
CustomizePlus.CheckAPI(); if (i == 0) Penumbra.CheckAPI();
Honorific.CheckAPI(); if (i == 1) Penumbra.CheckModDirectory();
PetNames.CheckAPI(); if (i == 2) Glamourer.CheckAPI();
Moodles.CheckAPI(); if (i == 3) Heels.CheckAPI();
if (i == 4) CustomizePlus.CheckAPI();
if (i == 5) Honorific.CheckAPI();
if (i == 6) PetNames.CheckAPI();
if (i == 7) Moodles.CheckAPI();
} }
} }

View File

@@ -642,11 +642,11 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
if (_charaHandler?.Address != nint.Zero && !IsVisible) if (_charaHandler?.Address != nint.Zero && !IsVisible)
{ {
Guid appData = Guid.NewGuid();
IsVisible = true; IsVisible = true;
Mediator.Publish(new PairHandlerVisibleMessage(this)); Mediator.Publish(new PairHandlerVisibleMessage(this));
if (_cachedData != null) if (_cachedData != null)
{ {
Guid appData = Guid.NewGuid();
Logger.LogTrace("[BASE-{appBase}] {this} visibility changed, now: {visi}, cached data exists", appData, this, IsVisible); Logger.LogTrace("[BASE-{appBase}] {this} visibility changed, now: {visi}, cached data exists", appData, this, IsVisible);
_ = Task.Run(() => _ = Task.Run(() =>

View File

@@ -169,7 +169,7 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
_ = Task.Run(async () => _ = Task.Run(async () =>
{ {
await Task.Delay(TimeSpan.FromSeconds(1), token).ConfigureAwait(false); await Task.Delay(TimeSpan.FromMilliseconds(500), token).ConfigureAwait(false);
await AddPlayerCacheToCreate(kind).ConfigureAwait(false); await AddPlayerCacheToCreate(kind).ConfigureAwait(false);
}); });
} }
@@ -183,7 +183,7 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
_ = Task.Run(async () => _ = Task.Run(async () =>
{ {
await Task.Delay(TimeSpan.FromSeconds(3), token).ConfigureAwait(false); await Task.Delay(TimeSpan.FromSeconds(1), token).ConfigureAwait(false);
await AddPlayerCacheToCreate().ConfigureAwait(false); await AddPlayerCacheToCreate().ConfigureAwait(false);
}, token); }, token);
} }
@@ -197,7 +197,7 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
_ = Task.Run(async () => _ = Task.Run(async () =>
{ {
await Task.Delay(TimeSpan.FromSeconds(3), token).ConfigureAwait(false); await Task.Delay(TimeSpan.FromSeconds(1), token).ConfigureAwait(false);
await AddPlayerCacheToCreate().ConfigureAwait(false); await AddPlayerCacheToCreate().ConfigureAwait(false);
}, token); }, token);
} }
@@ -211,7 +211,7 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
_ = Task.Run(async () => _ = Task.Run(async () =>
{ {
await Task.Delay(TimeSpan.FromSeconds(2), token).ConfigureAwait(false); await Task.Delay(TimeSpan.FromSeconds(1), token).ConfigureAwait(false);
await AddPlayerCacheToCreate().ConfigureAwait(false); await AddPlayerCacheToCreate().ConfigureAwait(false);
}, token); }, token);
} }

View File

@@ -482,7 +482,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
return; return;
} }
bool isNormalFrameworkUpdate = DateTime.UtcNow < _delayedFrameworkUpdateCheck.AddSeconds(1); bool isNormalFrameworkUpdate = DateTime.UtcNow < _delayedFrameworkUpdateCheck.AddMilliseconds(200);
_performanceCollector.LogPerformance(this, $"FrameworkOnUpdateInternal+{(isNormalFrameworkUpdate ? "Regular" : "Delayed")}", () => _performanceCollector.LogPerformance(this, $"FrameworkOnUpdateInternal+{(isNormalFrameworkUpdate ? "Regular" : "Delayed")}", () =>
{ {