mirror of
https://github.com/9ParsonsB/Pulsar.git
synced 2025-04-18 09:00:38 -04:00
Manually trigger Lua GC periodically.
This commit is contained in:
parent
bb9185ef8a
commit
2200b94a6c
@ -13,12 +13,13 @@ namespace Observatory.Explorer
|
|||||||
private Lua LuaState;
|
private Lua LuaState;
|
||||||
private List<LuaFunction> CriteriaFunctions;
|
private List<LuaFunction> CriteriaFunctions;
|
||||||
Action<Exception, String> ErrorLogger;
|
Action<Exception, String> ErrorLogger;
|
||||||
|
private uint ScanCount;
|
||||||
|
|
||||||
public CustomCriteriaManager(Action<Exception, String> errorLogger)
|
public CustomCriteriaManager(Action<Exception, String> errorLogger)
|
||||||
{
|
{
|
||||||
ErrorLogger = errorLogger;
|
ErrorLogger = errorLogger;
|
||||||
CriteriaFunctions = new();
|
CriteriaFunctions = new();
|
||||||
|
ScanCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshCriteria(string criteriaPath)
|
public void RefreshCriteria(string criteriaPath)
|
||||||
@ -191,7 +192,8 @@ namespace Observatory.Explorer
|
|||||||
public List<(string, string, bool)> CheckInterest(Scan scan, Dictionary<ulong, Dictionary<int, Scan>> scanHistory, Dictionary<ulong, Dictionary<int, FSSBodySignals>> signalHistory, ExplorerSettings settings)
|
public List<(string, string, bool)> CheckInterest(Scan scan, Dictionary<ulong, Dictionary<int, Scan>> scanHistory, Dictionary<ulong, Dictionary<int, FSSBodySignals>> signalHistory, ExplorerSettings settings)
|
||||||
{
|
{
|
||||||
List<(string, string, bool)> results = new();
|
List<(string, string, bool)> results = new();
|
||||||
|
ScanCount++;
|
||||||
|
|
||||||
foreach (var criteriaFunction in CriteriaFunctions)
|
foreach (var criteriaFunction in CriteriaFunctions)
|
||||||
{
|
{
|
||||||
var scanList = scanHistory[scan.SystemAddress].Values.ToList();
|
var scanList = scanHistory[scan.SystemAddress].Values.ToList();
|
||||||
@ -255,9 +257,20 @@ namespace Observatory.Explorer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ScanCount > 99)
|
||||||
|
{
|
||||||
|
ScanCount = 0;
|
||||||
|
LuaGC();
|
||||||
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LuaGC()
|
||||||
|
{
|
||||||
|
LuaState.DoString("collectgarbage()");
|
||||||
|
}
|
||||||
|
|
||||||
internal class Parent
|
internal class Parent
|
||||||
{
|
{
|
||||||
public string ParentType;
|
public string ParentType;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user