Skip to content

Commit 95c5508

Browse files
committed
Provide more descriptive type spec
1 parent bfa856f commit 95c5508

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

deps/rabbit/include/mc.hrl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
-type death_key() :: {Queue :: rabbit_misc:resource_name(), rabbit_dead_letter:reason()}.
1+
-type death_key() :: {SourceQueue :: rabbit_misc:resource_name(), rabbit_dead_letter:reason()}.
22
-type death_anns() :: #{first_time := non_neg_integer(), %% the timestamp of the first
33
last_time := non_neg_integer(), %% the timestamp of the last
4-
ttl => non_neg_integer()}.
5-
-record(death, {
6-
exchange :: rabbit_misc:resource_name(),
7-
routing_keys = [] :: [rabbit_types:routing_key()],
4+
ttl => OriginalExpiration :: non_neg_integer()}.
5+
-record(death, {exchange :: OriginalExchange :: rabbit_misc:resource_name(),
6+
routing_keys = [] :: OriginalRoutingKeys :: [rabbit_types:routing_key()],
87
count = 0 :: non_neg_integer(),
9-
anns :: death_anns()
10-
}).
8+
anns :: death_anns()}).
119

1210
-record(deaths, {first :: death_key(),
1311
last :: death_key(),

deps/rabbit/src/mc_amqp.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ recover_deaths([], Acc) ->
399399
Acc;
400400
recover_deaths([{map, Kvs} | Rem], Acc) ->
401401
Queue = key_find(<<"queue">>, Kvs),
402-
Reason = binary_to_atom(key_find(<<"reason">>, Kvs)),
402+
Reason = binary_to_existing_atom(key_find(<<"reason">>, Kvs)),
403403
DA0 = case key_find(<<"original-expiration">>, Kvs) of
404404
undefined ->
405405
#{};
@@ -431,8 +431,8 @@ essential_properties(#msg{message_annotations = MA} = Msg) ->
431431
{utf8, FstR} = message_annotation(<<"x-first-death-reason">>, Msg, Def),
432432
{utf8, LastQ} = message_annotation(<<"x-last-death-queue">>, Msg, Def),
433433
{utf8, LastR} = message_annotation(<<"x-last-death-reason">>, Msg, Def),
434-
#deaths{first = {FstQ, binary_to_atom(FstR)},
435-
last = {LastQ, binary_to_atom(LastR)},
434+
#deaths{first = {FstQ, binary_to_existing_atom(FstR)},
435+
last = {LastQ, binary_to_existing_atom(LastR)},
436436
records = recover_deaths(DeathMaps, #{})};
437437
_ ->
438438
undefined

0 commit comments

Comments
 (0)