Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • we don't have a UI, we have a windows service. I've included the proposed code fix bases on your answer and we still get the duplicate writes to the cloud. We look forward to your inputs. Commented Jul 30, 2018 at 15:18
  • If you mean that your ProcessCommandAsync() is called twince concurrently it is very strange. Are you sure you are using the same _mutex instance in all invocations of ProcessPostedCommandsAsync()? Commented Jul 30, 2018 at 20:17
  • @max36, By duplication, I mean that the same write command is kicked off twice and before the done processing flag is set in the database for the first command. Consequently, two duplicate writes are completed. Commented Jul 31, 2018 at 19:12
  • @max360, I added the declaration of _mutex in the example code. It is located in the same class. Commented Jul 31, 2018 at 19:17
  • 1
    Well I cannot say then. I believe the locks themselves should be working. See for example here. Check again if your system completes the ProcessCommandAsync's task only after processing is marked as done at server. Commented Aug 1, 2018 at 10:55