nickva commented on a change in pull request #6:
URL: https://github.com/apache/couchdb-ibrowse/pull/6#discussion_r638111904



##########
File path: src/ibrowse_http_client.erl
##########
@@ -1870,7 +1870,7 @@ cancel_timer(Ref, {eat_message, Msg}) ->
     end.
 
 make_req_id() ->
-    now().
+    timestamp().

Review comment:
       This one is a bit tricky. `now()` is a strictly monotonically increasing 
function, it guarantees that each call will give a value larger than the 
previous while `os:timestamp()` doesn't guarantee that. In most cases, when 
used as timestamp it doesn't matter but here if it's used to uniquely identify 
requests, it might change the behavior and possibly create two requests with 
identical request IDs
   
   We might have to look at the advice in 
https://erlang.org/doc/apps/erts/time_correction.html#Time_Warp_Modes how to 
deal with it. Perhaps we'd call `erlang:unique_integer([monotonic])` but we'd 
also want to keep the shape of the request ID variable in case client code 
matches on `{_, _, _}`. Maybe something like 
`{erlang:unique_integer([monotonic, positive]), 0, 0}`
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to