Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
ram utils?
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus-QC committed Nov 17, 2021
1 parent 6bd9c41 commit 78ba8db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 8 additions & 4 deletions SecretAdmin/Features/Server/MemoryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public class MemoryManager : IDisposable
public void Start()
{
_killed = false;
//Task.Run(CheckUse);
Task.Run(CheckUse);
}

/*private async void CheckUse()
private async void CheckUse()
{
await Task.Delay(5000);
while (!_killed)
Expand All @@ -34,13 +34,17 @@ public void Start()
{
Log.Raw($"LOW MEMORY. USING {mem}MB / {ConfigManager.SecretAdminConfig.MaxDefaultMemory}");
await Task.Delay(2500);
if(ConfigManager.SecretAdminConfig.RestartWithLowMemory)

if (ConfigManager.SecretAdminConfig.RestartWithLowMemory)
{
SecretAdmin.Program.Server.ForceRestart();
return;
}
}

await Task.Delay(5000);
}
}*/
}

public long GetMemory()
{
Expand Down
2 changes: 1 addition & 1 deletion SecretAdmin/Features/Server/SocketServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public async void ListenRequests()

public void Dispose()
{
_crashHandler.Dispose();
_crashHandler?.Dispose();
_client?.Close();
_listener?.Stop();
}
Expand Down
4 changes: 1 addition & 3 deletions SecretAdmin/Features/Server/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ public static void ArchiveControlLogs()
}

var zipName = Path.Combine(Paths.ProgramLogsFolder, $"{DateTime.Now:MM-dd-yyyy}-archive.zip");

Log.Raw(filesToArchive.Count);


if(!File.Exists(zipName))
File.WriteAllText(zipName, "");

Expand Down

0 comments on commit 78ba8db

Please sign in to comment.