Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into remove-dataflow
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock committed Dec 3, 2024
2 parents caac2a7 + c2bafc6 commit 4a7a961
Showing 1 changed file with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,32 @@ private async Task RunExpirationChecks()
}

var objUniqueIds = new List<string>();
var changedIds = ChangedObjectIds.Keys.ToList();

// Handling type changes: if an element's type is changed, we need to mark as changed all objects that have that type.
// Step 1: get any changed types
var elementTypeIdsList = changedIds
.Select(e => doc.GetElement(e))
.OfType<ElementType>()
.Select(el => el.Id)
.ToArray();

// Step 2: Find all elements of the changed types, and add them to the changed ids list.
if (elementTypeIdsList.Length != 0)
{
using var collector = new FilteredElementCollector(doc);
var collectorElements = collector
.WhereElementIsNotElementType()
.Where(e => elementTypeIdsList.Contains(e.GetTypeId()));
foreach (var elm in collectorElements)
{
changedIds.Add(elm.Id);
}
}

foreach (var sender in senders)
{
// if (sender.SendFilter is null) // NOTE: RunExpirationChecks sometimes triggered unnecessarily before send and, we didn't set up yet IdMap, if so we do not need to deal with it
// {
// continue;
// }

foreach (var changedElementId in ChangedObjectIds.Keys)
foreach (var changedElementId in changedIds)
{
if (sender.SendFilter?.IdMap?.TryGetValue(changedElementId.ToString(), out var id) ?? false)
{
Expand All @@ -360,21 +377,6 @@ private async Task RunExpirationChecks()
}
}

// foreach (var changedElementId in ChangedObjectIds.Keys.ToArray())
// {
// foreach (var sender in senders)
// {
// if (sender.SendFilter.NotNull().IdMap is null)
// {
// continue;
// }
// if (sender.SendFilter.NotNull().IdMap.NotNull().ContainsKey(changedElementId.ToString()))
// {
// objUniqueIds.Add(sender.SendFilter.NotNull().IdMap.NotNull()[changedElementId.ToString()]);
// }
// }
// }

var unpackedObjectIds = _elementUnpacker.GetUnpackedElementIds(objUniqueIds);
_sendConversionCache.EvictObjects(unpackedObjectIds);

Expand Down

0 comments on commit 4a7a961

Please sign in to comment.