Skip to content

Commit

Permalink
Ref server sample: Subscribe to SimulationActive corrupts the variable (
Browse files Browse the repository at this point in the history
#2290)

- only update the variable with new value if a new value is supplied by the underlying system
  • Loading branch information
mregen committed Aug 29, 2023
1 parent da5db41 commit 67c2ba9
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Applications/Quickstarts.Servers/TestData/TestDataSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -971,14 +971,17 @@ void DoSample(object state)
}
else
{
Sample sample = new Sample();

sample.Variable = variable;
sample.Value = ReadValue(sample.Variable);
sample.StatusCode = StatusCodes.Good;
sample.Timestamp = DateTime.UtcNow;

samples.Enqueue(sample);
object value = ReadValue(variable);
if (value != null)
{
Sample sample = new Sample {
Variable = variable,
Value = value,
StatusCode = StatusCodes.Good,
Timestamp = DateTime.UtcNow
};
samples.Enqueue(sample);
}
}
}
}
Expand Down

0 comments on commit 67c2ba9

Please sign in to comment.