Task downloading files, dealing with locks

I’ve inherited some code that polls for events and sometimes downloads a file from a remote service based on the events. These ‘events’ get queued up as Tasks. The problem I’m running into is a concurrency issue. Sometimes a file is in use/locked at the moment the download starts, and as expected, I get an exception. Age-old issue, no?

Here is my question:

Using Tasks, is there a standard approach to detecting file locks and delaying a download when locked?

Thank you for any direction you may impart!

submitted by /u/reddevit
[link] [comments]

Leave a Reply