@@ -391,11 +391,11 @@ defmodule Mix.Sync.Lock do
391391 # consists of 1 switch byte (either 0 or 1) and two content segments
392392 # with fixed, equal lengths. The switch byte indicates which segment
393393 # is currently active. To replace the file content, we write to the
394- # non-active segment and call :file.sync/1 to ensure the segment is
395- # persisted, then we toggle the switch byte. While we cannot write
396- # multiple bytes atomically (since they may reside in multiple disk
397- # sectors), if we toggle only a single byte, there is no intermediate
398- # invalid state, which gives us the atomic replace we need.
394+ # non-active segment, then we toggle the switch byte. While we cannot
395+ # write multiple bytes atomically (since they may reside in multiple
396+ # disk sectors), if we toggle only a single byte, there is no
397+ # intermediate invalid state, which gives us the atomic replace we
398+ # need.
399399 #
400400 # Note that file content can be replaced only by a single process
401401 # at a time.
@@ -421,11 +421,11 @@ defmodule Mix.Sync.Lock do
421421 end
422422
423423 # Write new data
424- file_pwrite_sync !( file , inactive_content_position , new_content )
424+ file_pwrite !( file , inactive_content_position , new_content )
425425
426426 # Toggle switch byte - it's a single byte so the content changes
427427 # atomically
428- file_pwrite_sync !( file , 0 , << 1 - switch_byte >> )
428+ file_pwrite !( file , 0 , << 1 - switch_byte >> )
429429 after
430430 File . close ( file )
431431 end
@@ -457,16 +457,10 @@ defmodule Mix.Sync.Lock do
457457 end
458458 end
459459
460- defp file_pwrite_sync !( file , position , bytes ) do
460+ defp file_pwrite !( file , position , bytes ) do
461461 case :file . pwrite ( file , position , bytes ) do
462462 :ok ->
463- case :file . sync ( file ) do
464- :ok ->
465- :ok
466-
467- { :error , reason } ->
468- raise File.Error , reason: reason , action: "sync file"
469- end
463+ :ok
470464
471465 { :error , reason } ->
472466 raise File.Error , reason: reason , action: "write to file at position"
0 commit comments