Concurrent Event Receiver Instances

Dec 8 2015 3:16 PM

I have a document library with an event receiver (on ItemCheckedIn) to update an xml file with the contents of this library (Kind of custom rss feed). XML file resides in another library.

Everything works fine if I add/delete one document at a time from the library. But if I add (and check-in) multiple files at the same time, multiple instances of the event receiver gets fired concurrently and try to update the xml file at the same time resulting in error: File is in use by another process.

I have already tried <Synchronization>Synchronous</Synchronization> and this.EventFiringEnabled = false/true and Thread.Sleep(1000); but all of these doesn't seem to help.

Is there any other way to do this?


Answers (1)