This commit is contained in:
Archi 2024-01-01 23:00:58 +01:00
parent ac427ed1ec
commit d398e84f25
No known key found for this signature in database
GPG key ID: 6B138B4C64555AEA
2 changed files with 11 additions and 2 deletions

View file

@ -96,7 +96,7 @@ internal static class Commands {
return bot.Commands.FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, nameof(remoteCommunication)));
}
remoteCommunication.TriggerMatchActively();
remoteCommunication.TriggerMatchActivelyEarlier();
return bot.Commands.FormatBotResponse(Strings.Done);
}

View file

@ -771,7 +771,16 @@ internal sealed class RemoteCommunication : IAsyncDisposable, IDisposable {
}
}
internal void TriggerMatchActively() => Utilities.InBackground(() => MatchActively());
internal void TriggerMatchActivelyEarlier() {
if (MatchActivelyTimer == null) {
Utilities.InBackground(() => MatchActively());
} else {
// ReSharper disable once SuspiciousLockOverSynchronizationPrimitive - this is not a mistake, we need extra synchronization, and we can re-use the semaphore object for that
lock (MatchActivelySemaphore) {
MatchActivelyTimer.Change(TimeSpan.Zero, TimeSpan.FromHours(6));
}
}
}
private async Task<bool?> IsEligibleForListing() {
// Bot must be eligible for matching