Remove some lock contention when fsync’ing
This commit is contained in:
parent
0fa8ab4a02
commit
1715c29364
1 changed files with 4 additions and 4 deletions
|
@ -142,12 +142,12 @@ do_sync(File, Nursery) ->
|
|||
case application:get_env(hanoidb, sync_strategy) of
|
||||
{ok, sync} ->
|
||||
file:datasync(File),
|
||||
now();
|
||||
os:timestamp();
|
||||
{ok, {seconds, N}} ->
|
||||
MicrosSinceLastSync = timer:now_diff(now(), Nursery#nursery.last_sync),
|
||||
if (MicrosSinceLastSync / 1000000) >= N ->
|
||||
MicrosSinceLastSync = timer:now_diff(os:timestamp(), Nursery#nursery.last_sync),
|
||||
if (MicrosSinceLastSync div 1000000) >= N ->
|
||||
file:datasync(File),
|
||||
now();
|
||||
os:timestamp();
|
||||
true ->
|
||||
Nursery#nursery.last_sync
|
||||
end;
|
||||
|
|
Loading…
Reference in a new issue