浏览代码

Remove TODO and add a second file:close due to delayed write

pull/509/head
Luke Bakken 5 年前
父节点
当前提交
4ed9b558ac
找不到此签名对应的密钥 GPG 密钥 ID: D99DE30E43EAE440
共有 2 个文件被更改,包括 1 次插入1 次删除
  1. +0
    -1
      src/lager_file_backend.erl
  2. +1
    -0
      src/lager_rotator_default.erl

+ 0
- 1
src/lager_file_backend.erl 查看文件

@ -472,7 +472,6 @@ close_file(#state{fd=undefined} = State) ->
State; State;
close_file(#state{fd=FD} = State) -> close_file(#state{fd=FD} = State) ->
%% Flush and close any file handles. %% Flush and close any file handles.
%% TODO LRB don't match, but report errors???
_ = file:datasync(FD), _ = file:datasync(FD),
%% delayed write can cause file:close not to do a close %% delayed write can cause file:close not to do a close
_ = file:close(FD), _ = file:close(FD),

+ 1
- 0
src/lager_rotator_default.erl 查看文件

@ -67,6 +67,7 @@ rotate_logfile(File, 0) ->
%% open the file in write-only mode to truncate/create it %% open the file in write-only mode to truncate/create it
case file:open(File, [write]) of case file:open(File, [write]) of
{ok, FD} -> {ok, FD} ->
_ = file:close(FD),
_ = file:close(FD), _ = file:close(FD),
{ok, _Ctime} = maybe_update_ctime(File), {ok, _Ctime} = maybe_update_ctime(File),
ok; ok;

正在加载...
取消
保存