mirror of
https://github.com/valitydev/woody_erlang.git
synced 2024-11-06 02:15:19 +00:00
Update snowflake (#133)
This commit is contained in:
parent
8b8c0e2779
commit
8543878a55
@ -29,7 +29,7 @@
|
||||
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.7.1">>},1},
|
||||
{<<"snowflake">>,
|
||||
{git,"https://github.com/rbkmoney/snowflake.git",
|
||||
{ref,"0a598108f6582affe3b4ae550fc5b9f2062e318a"}},
|
||||
{ref,"c34a962e17539e63a53f721cbf4ddcffeb0032a4"}},
|
||||
0},
|
||||
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.5">>},1},
|
||||
{<<"thrift">>,
|
||||
|
@ -129,8 +129,17 @@ new_req_id() ->
|
||||
-spec new_unique_int() ->
|
||||
pos_integer().
|
||||
new_unique_int() ->
|
||||
<<Id:64>> = snowflake:new(?MODULE),
|
||||
Id.
|
||||
try snowflake:new(?MODULE) of
|
||||
<<Id:64>> ->
|
||||
Id
|
||||
catch
|
||||
error:{backward_clock_moving, _Last, _New} = Reason ->
|
||||
BinReason = woody_error:format_details({snowflake, Reason}),
|
||||
woody_error:raise(system, {internal, resource_unavailable, BinReason});
|
||||
error:exhausted = Reason ->
|
||||
BinReason = woody_error:format_details({snowflake, Reason}),
|
||||
woody_error:raise(system, {internal, resource_unavailable, BinReason})
|
||||
end.
|
||||
|
||||
-spec set_deadline(woody:deadline(), ctx()) ->
|
||||
ctx().
|
||||
|
Loading…
Reference in New Issue
Block a user