Skip to content

Commit 4cad823

Browse files
committed
add best-effort locking to single-part upload
1 parent 6cc2e5b commit 4cad823

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

internal/turso/tursoServer.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ func (i *TursoServerClient) UploadFileSinglePart(filepath, remoteEncryptionCiphe
6868
}
6969
defer file.Close()
7070

71+
// locking is on a best effort basis
72+
if unlock, err := lockFileExclusive(file); err == nil {
73+
defer unlock()
74+
}
75+
7176
stat, err := file.Stat()
7277
if err != nil {
7378
return fmt.Errorf("failed to get file stats for %s: %w", filepath, err)

0 commit comments

Comments
 (0)