Skip to content

Commit

Permalink
InputBased.Clone(): don't clone the timestamp, but use the current ti…
Browse files Browse the repository at this point in the history
…me - otherwise LegacyFilter is not able to remove old samples from its queue causing a memory leak.
  • Loading branch information
LarsWithCA committed Jan 23, 2025
1 parent ac1bdf4 commit e274b3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CA_DataUploaderLib/BaseSensorBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ public enum ConnectionState
NodeUnreachable = -1, // can be used by distributed deployments to indicate the node that has the board is unreachable
Disconnected = 0, // we are not currently connected to the board
Connecting = 1, // we are attempting to reconnect to the board
Connected = 2, // we have succesfully connected to the board and will soon be attempting to read from it
Connected = 2, // we have successfully connected to the board and will soon be attempting to read from it
ReadError = 3, // there are unexpected exceptions communicating with the board
NoDataAvailable = 4, // we are connected to the box, but we have not received for 150ms+
ReturningNonValues = 5, // we are getting data from the box, but these are not values lines
Expand Down
11 changes: 2 additions & 9 deletions CA_DataUploaderLib/SensorSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public double Value {
private DateTime _timeStamp;
public DateTime TimeStamp
{
get { return _timeStamp; }
get => _timeStamp;
set { ReadSensor_LoopTime = value.Subtract(_timeStamp).TotalMilliseconds; _timeStamp = value; }
}
public double ReadSensor_LoopTime { get; private set; } // in milliseconds.
Expand All @@ -45,14 +45,7 @@ public InputBased(IOconfInput input, double value = 0) : base(input, value)
public new IOconfInput Input => base.Input!;

public bool HasSpecialDisconnectValue() => Input.IsSpecialDisconnectValue(Value);
public InputBased Clone()
{
return new InputBased(Input, Value)
{
_timeStamp = TimeStamp,
ReadSensor_LoopTime = ReadSensor_LoopTime
};
}
public InputBased Clone() => new(Input, Value);
}
}
}

0 comments on commit e274b3d

Please sign in to comment.