c# - Prevent multiple transfer operations with Azure Storage Data Movement Library -
i started use azure storage data movement library (dml) having code similar public dml sample code. use case (incrementally) sync local directory blob storage several times while files in directory updated time time.
uploaddirectoryoptions options = new uploaddirectoryoptions { searchpattern = "*.*", recursive = false, blobtype = blobtype.blockblob }; // register transfer event. directorytransfercontext context = new directorytransfercontext(); //only copy newer files - similar azcopy /xo /xn switches //https://github.com/azure/azure-storage-net-data-movement/issues/12 context.shouldoverwritecallback = (source, destination) => { var sourcefile = new fileinfo((string)source); var destblob = destination cloudblob; return sourcefile.lastwritetimeutc > destblob.properties.lastmodified; }; // start upload var transferstatus = await transfermanager.uploaddirectoryasync(sourcedirpath, destdir, options, context);
currently transfer operation triggered application event. having experimented couple of events in short time, raised exception shown below. since transfermanager static class, how address requirement in application , prevent such exceptions?
microsoft.windowsazure.storage.datamovement.transferexception unhandled message: unhandled exception of type 'microsoft.windowsazure.storage.datamovement.transferexception' occurred in mscorlib.dll additional information: transfer operation same source , destination exists.
have added more 1 transfer task same source/destination transfermanager (such as, run above code several times in application) . if so, meet issue dmlib don't allow run more 1 transfer task same source/destination @ same time.
Comments
Post a Comment