Replies: 3 comments 5 replies
-
If you will do implementation for this, start from unit tests. We made the similar functionality some time ago for tenv in scope of tofuutils/tenv#116 and found interesting differences between |
Beta Was this translation helpful? Give feedback.
-
@yermulnik lets plan this for a future release |
Beta Was this translation helpful? Give feedback.
-
Given that we write to quite a few files, i.e. checksum, RECENT, public keys, the binary and the temporary files when installing a new version, I wonder if it's worth implementing a dedicated lock file (maybe a PID file on linux). This could be created/locked when performing any "writeable" action (i.e. selecting a version, rather dry-run). This does make me ask a larger question though, since tfswitch's main function is to set a symlink pointing to a version, if it's being run twice simultaneously, either:
If we did go down this method, though, we'd need to: lock the file immediately, have a timeout waiting for the lock and we'd need to re-evalulate very carefully to ensure the lock file is removed in any failure cases - this might means moving away from Fatals (everywhere!)? |
Beta Was this translation helpful? Give feedback.
-
Would it make sense to implement locking for TF archive and signature/checksum files during download and for destination TF file during install to avoid possible race conditions for when
tfswitch
is run for the same TF version be several different means (e.g. within two different CI pipelines inside the same CI worker)?@warrensbox @MatrixCrawler @crablab @MatthewJohn @jukie
Beta Was this translation helpful? Give feedback.
All reactions