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
|
case application:get_env(hanoidb, sync_strategy) of
|
||||||
{ok, sync} ->
|
{ok, sync} ->
|
||||||
file:datasync(File),
|
file:datasync(File),
|
||||||
now();
|
os:timestamp();
|
||||||
{ok, {seconds, N}} ->
|
{ok, {seconds, N}} ->
|
||||||
MicrosSinceLastSync = timer:now_diff(now(), Nursery#nursery.last_sync),
|
MicrosSinceLastSync = timer:now_diff(os:timestamp(), Nursery#nursery.last_sync),
|
||||||
if (MicrosSinceLastSync / 1000000) >= N ->
|
if (MicrosSinceLastSync div 1000000) >= N ->
|
||||||
file:datasync(File),
|
file:datasync(File),
|
||||||
now();
|
os:timestamp();
|
||||||
true ->
|
true ->
|
||||||
Nursery#nursery.last_sync
|
Nursery#nursery.last_sync
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in a new issue