
Posted: 2018-05-02 03:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
I have a long running processor that relies upon the values in ProcessorValues. I also have a custom setValueProcessor that updates these PV values. Every 5 seconds the processor asks for the current values, this has been updated by the setValueProcessor but the copy of the PV values my processor gets is from when the process started.
How can I force the method below to get the database instance of PV values rather than a cached instance?
protected ProcessorValue FindOrCreateProcessorValue(string key, string group = null, string aggregate = null)
{
var pv = this.ProcessorValueSource.Items.FirstOrDefault(x => x.Key == key && (group == null || x.Group == group) && (aggregate == null || x.Aggregate == aggregate));
if (pv == null)
{
pv = new ProcessorValue
{
Key = key,
Group = group,
Aggregate = aggregate,
};
ProcessorValueSource.Add(pv);
ProcessorValueSource.Save();
}
return pv;
}
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
You don't need to call the object factory.Simply calling DisposeOfProcessorValueDataSource() from your Processor is sufficient.
ProcessorValueSource is lazy loaded when it is next needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Hi James!
Good question, I took a look at the source, and it looks as though you should be able to refresh your processor values source by setting it to a new instance of IProcessorValueDataSource. Try the below:
this.ProcessorValueSource = MongooseObjectFactory.Current.GetInstance<IProcessorValueDataSource>();
Regards,
-Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.

