nickva commented on a change in pull request #6:
URL: https://github.com/apache/couchdb-ibrowse/pull/6#discussion_r638210107
##########
File path: src/ibrowse_http_client.erl
##########
@@ -465,7 +465,7 @@ accumulate_response(Data, #state{reply_buffer = RepBuf,
make_tmp_filename(true) ->
DownloadDir = ibrowse:get_config_value(download_dir,
filename:absname("./")),
- {A,B,C} = now(),
+ {A,B,C} = {erlang:unique_integer([positive, monotonic]), 0, 0},
Review comment:
Good call. Here it also expects it to be strictly monotonic. But seeing
that this creates a file made me think of another case when the erlang VM is
restarted. In that case the counter will be reset to 0 and so filenames might
collide. I think we might want to keep at least some connection to wall clock
time here.
Perhaps something like:
```
strictly_monotonic_timestamp() ->
{A, B, C} = erlang:timestamp(),
Unique = erlang:unique_integer([positive, monotonic]),
{A, B, C + Unique}.
```
--
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]