Update snowflake (#133)

This commit is contained in:
Andrey Fadeev 2020-03-31 16:37:41 +03:00 committed by GitHub
parent 8b8c0e2779
commit 8543878a55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -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">>,

View File

@ -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().