mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Resolve CA2002
This commit is contained in:
parent
809a4bbfbf
commit
e7537ca996
4 changed files with 6 additions and 6 deletions
|
@ -111,7 +111,6 @@ dotnet_diagnostic.ca1028.severity = silent
|
|||
dotnet_diagnostic.ca1031.severity = silent
|
||||
|
||||
# TODO - one at a time
|
||||
dotnet_diagnostic.ca2002.severity = silent
|
||||
dotnet_diagnostic.ca3003.severity = silent
|
||||
dotnet_diagnostic.ca3012.severity = silent
|
||||
dotnet_diagnostic.ca3075.severity = silent
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace ArchiSteamFarm.CustomPlugins.PeriodicGC {
|
|||
internal sealed class PeriodicGCPlugin : IPlugin {
|
||||
private const byte GCPeriod = 60; // In seconds
|
||||
|
||||
private static readonly object LockObject = new();
|
||||
private static readonly Timer PeriodicGCTimer = new(PerformGC);
|
||||
|
||||
public string Name => nameof(PeriodicGCPlugin);
|
||||
|
@ -43,7 +44,7 @@ namespace ArchiSteamFarm.CustomPlugins.PeriodicGC {
|
|||
|
||||
ASF.ArchiLogger.LogGenericWarning("Periodic GC will occur every " + timeSpan.ToHumanReadable() + ". Please keep in mind that this plugin should be used for debugging tests only.");
|
||||
|
||||
lock (PeriodicGCTimer) {
|
||||
lock (LockObject) {
|
||||
PeriodicGCTimer.Change(timeSpan, timeSpan);
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +52,7 @@ namespace ArchiSteamFarm.CustomPlugins.PeriodicGC {
|
|||
private static void PerformGC(object? state) {
|
||||
ASF.ArchiLogger.LogGenericWarning("Performing GC, current memory: " + (GC.GetTotalMemory(false) / 1024) + " KB.");
|
||||
|
||||
lock (PeriodicGCTimer) {
|
||||
lock (LockObject) {
|
||||
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
|
||||
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true, true);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
|
|||
|
||||
TimeSpan startIn = TimeSpan.FromMinutes(Utilities.RandomNext(SharedInfo.MinimumMinutesBeforeFirstUpload, SharedInfo.MaximumMinutesBeforeFirstUpload));
|
||||
|
||||
lock (SubmissionTimer) {
|
||||
lock (SubmissionSemaphore) {
|
||||
SubmissionTimer.Change(startIn, TimeSpan.FromHours(SharedInfo.MinimumHoursBetweenUploads));
|
||||
}
|
||||
|
||||
|
@ -533,7 +533,7 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
|
|||
#endif
|
||||
TimeSpan startIn = TimeSpan.FromMinutes(Utilities.RandomNext(SharedInfo.MinimumMinutesBeforeFirstUpload, SharedInfo.MaximumMinutesBeforeFirstUpload));
|
||||
|
||||
lock (SubmissionTimer) {
|
||||
lock (SubmissionSemaphore) {
|
||||
SubmissionTimer.Change(startIn, TimeSpan.FromHours(SharedInfo.MinimumHoursBetweenUploads));
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace ArchiSteamFarm {
|
|||
return;
|
||||
}
|
||||
|
||||
lock (RefreshTimer) {
|
||||
lock (RefreshSemaphore) {
|
||||
if (TimerAlreadySet) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue