Memory optimized the FLUTE

This commit is contained in:
feyris-tan 2025-06-21 13:34:31 +02:00
parent 40c2ac21b6
commit c4a4887a81
3 changed files with 21 additions and 20 deletions

View File

@ -142,27 +142,24 @@ namespace skyscraper8.DvbNip
private void TryPruneCache()
{
/*
DateTime now = DateTime.Now;
List<FluteListener> staleListeners = flutes.Where(x => x.LastTouched != DateTime.MinValue)
.Where(x => x.FileAssociation != null)
.Where(x => (now - x.LastTouched).TotalMinutes >= 1.0)
.Where(x => DvbNipUtilities.IsContinuousFileType(x.FileAssociation))
List<KeyValuePair<Tuple<IPAddress, ushort, ulong, ulong>, FluteListener>> staleListeners = flutes.Where(x => x.Value.LastTouched != DateTime.MinValue)
.Where(x => x.Value.FileAssociation != null)
.Where(x => (now - x.Value.LastTouched).TotalMinutes >= 1.0)
.Where(x => DvbNipUtilities.IsContinuousFileType(x.Value.FileAssociation))
.ToList();
if (staleListeners.Count > 0)
{
int prevItems = flutes.Count;
foreach (FluteListener staleListener in staleListeners)
foreach (KeyValuePair<Tuple<IPAddress, ushort, ulong, ulong>, FluteListener> staleListener in
staleListeners)
{
staleListener.Disabled = true;
flutes.Remove(staleListener);
staleListener.Value.Disabled = true;
flutes.Remove(staleListener.Key);
}
int nowItems = flutes.Count;
logger.DebugFormat(String.Format("Removed {0} stale segments from FLUTE cache. Cache slimmed from {1} to {2} items.", staleListeners.Count,prevItems,nowItems));
}*/
logger.DebugFormat(String.Format("Removed {0} stale segments from FLUTE cache. Cache slimmed from {1} to {2} items.", staleListeners.Count, prevItems, nowItems));
}
}
private bool SetFileAssociations(FluteListener sourceListener, FDTInstanceType fdtAnnouncement)

View File

@ -38,9 +38,9 @@ namespace skyscraper8.Ietf.FLUTE
}
if (FileAssociation != null)
{
return String.Format("IP={0}, Port={1}, TSI={2}, TOI={3}, Filename={4}", DestinationAddress, DestinationPort, DestinationTsi, DestinationToi, FileAssociation.ContentLocation);
return String.Format("Filename={4}", DestinationAddress, DestinationPort, DestinationTsi, DestinationToi, FileAssociation.ContentLocation);
}
return String.Format("IP={0}, Port={1}, TSI={2}, TOI={3}", DestinationAddress, DestinationPort, DestinationTsi, DestinationToi);
return String.Format("???");
}
internal void PushPacket(LctFrame lctFrame)

View File

@ -2476,11 +2476,15 @@ namespace skyscraper5.Skyscraper.Scraper
{
if (filetype != null)
{
string extension = Path.GetExtension(filetype.ContentLocation).ToLowerInvariant();
if (!DvbNipUtilities.IsContinuousFileType(extension))
{
LogEvent(SkyscraperContextEvent.FluteFileProgress, String.Format("Filename={0}, {1}%", filetype.ContentLocation, progress));
}
if (!filetype.ContentLocation.Equals("urn:dvb:metadata:cs:NativeIPMulticastTransportObjectTypeCS:2023:bootstrap"))
{
string extension = Path.GetExtension(filetype.ContentLocation).ToLowerInvariant();
if (!DvbNipUtilities.IsContinuousFileType(extension))
{
LogEvent(SkyscraperContextEvent.FluteFileProgress,
String.Format("Filename={0}, {1}%", filetype.ContentLocation, progress));
}
}
}
}
}