Hi,
I'm fairly new to the VAFs but I have encountered this a few times.
[TaskProcessor(MyTaskId, MyTaskType, TransactionMode = TransactionMode.Unsafe, MaxRequeues = 0, MaxRetries = 0)] [ShowOnDashboard("My Task Processor", ShowRunCommand = true)] public void MyTaskProcessor(ITaskProcessingJob<TaskDirective> job) { //ID, data Dictionary<int, ApiData> apiDataItems = FetchDataFromSomeApi(); var sb = new MFSearchBuilder(job.Vault) .ObjType(Configuration.Structure.Objects.SomeObjType) .Class(Configuration.Structure.Classes.SomeClass) .PropertyNotMissing(Configuration.Structure.Properties.SomeTextProperty) .Deleted(false) .IsCheckedOut(false); List<ObjVerEx> foundObjects = sb.FindEx(); foreach (var obj in foundObjects) { if (apiDataItems.TryGetValue(obj.ID, out var item)) { //Could check here if modified obj.SaveProperty(Configuration.Structure.Properties.SomeTextProperty, MFDataType.MFDatatypeText, item.Value); } } }
In the example above I have to call SaveProperty which is a pretty slow operation when called multiple times in a row. Is there a way to update properties in batches?
- Eetu