-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take use of lease to ensure only a single instance of migration tool …
…can upload the generated files to the destination folder Description: In a rare case when two or more instances of the migration tool ("assets" or "storage" command) want to upload the generated files into the same destination folder, this change will ensure only a single instance of the tool is allowed to upload files, the other instances of tool would just skip the process of the asset immediately. The change takes use of the lease of blob __migrate inside the output folder to ensure above behavior. For any given input asset, once the destination folder is figured out based on the command line options, before it starts to do the actual migrating and uploading work, the code will check the lease of that blob, if it can acquire the lease, It will update the blob's modification time and keep holding the lease, continue the migrating work, the code then releases the lease after the work is done, no matter it is succeed or failed. If one previous tool has been holding the lease and didn't release it due to crash or ctrl+c, the new logic can detect it by checking the last modification time of the migration lease blob, if the lease was held for too long time, such as 12 hours, the code will break the lease and re-acquire the lease with the new lease-Id. When the tool has acquired the lease, besides the update of the modification time of the blob, it also tries to check if the output folder contains media files that might be generated by previous tool, those media files are all deleted before the new run of the migration tool so that container won't contain the mixed media files that are generated by two or more different instances of migration tool. The behavior is verified on both Windows and WSL environment for "assets" and "storage" command.
- Loading branch information
Showing
8 changed files
with
302 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.