VAPI Script - Object Locked Error
I have a VAPI script which performs some actions then uploads two attachements to the current run using the code below
TDHelper.UploadAttachment xmlResultFileName, CurrentRun
This is working fine and the attachments are being uploaded. What I'm findind is occassionally we get an 'Object is Locked' message when the CurrentRun Status is being updated to 'Passed' or 'Failed' at the end of the script. The attachments are still uploaded but the run status is blank.
I'm thinking that the status is trying to be updated before the lock on the run is being released from the previous upload. We can put a sleep in the code to get around the issue but I'm looking for a cleaner way to verify that the lock has been released before moving on. Is there away to run a query directly on the Locks table from within a VAPI script. The users running the script will not be project admins