Skip to content

Commit 8cabcee

Browse files
generatedunixname1440652887763105meta-codesync[bot]
authored andcommitted
whatsapp/server/erl/wa_raft/src/wa_raft_dist_transport.erl
Reviewed By: michalmuskala Differential Revision: D93080037 fbshipit-source-id: d716598e7478d854097154b6c8c492ecb69723b7
1 parent 8f62b9f commit 8cabcee

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/wa_raft_dist_transport.erl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ transport_send(ID, FileID, State) ->
6666
case prim_file:open(Path, [binary, read]) of
6767
{ok, Fd} ->
6868
try
69-
catch prim_file:advise(Fd, 0, 0, sequential),
69+
try prim_file:advise(Fd, 0, 0, sequential)
70+
catch _:_ -> ok
71+
end,
7072
case transport_send_loop(ID, FileID, Fd, Peer, State) of
7173
{ok, NewState} ->
7274
{ok, NewState};
@@ -218,7 +220,9 @@ open_file(ID, FileID, #receiver_state{fds = Fds} = State0) ->
218220
#{} ->
219221
case wa_raft_transport:file_info(ID, FileID) of
220222
{ok, #{name := File, path := Path}} ->
221-
catch filelib:ensure_dir(Path),
223+
try filelib:ensure_dir(Path)
224+
catch _:_ -> ok
225+
end,
222226
case prim_file:open(Path, [binary, write]) of
223227
{ok, Fd} ->
224228
State1 = State0#receiver_state{fds = Fds#{{ID, FileID} => Fd}},
@@ -240,7 +244,9 @@ open_file(ID, FileID, #receiver_state{fds = Fds} = State0) ->
240244
close_file(ID, FileID, #receiver_state{fds = Fds} = State0) ->
241245
case Fds of
242246
#{{ID, FileID} := Fd} ->
243-
catch prim_file:close(Fd),
247+
try prim_file:close(Fd)
248+
catch _:_ -> ok
249+
end,
244250
State1 = State0#receiver_state{fds = maps:remove({ID, FileID}, Fds)},
245251
{ok, State1};
246252
_ ->

0 commit comments

Comments
 (0)