aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-07-27 17:30:17 +0200
committerLoïc Hoguin <[email protected]>2015-07-27 17:30:17 +0200
commite92385038957dcda1429ee4fd93e921f3eb30f81 (patch)
treef1cadd030e100770efc880a43b25ea967f68f2f5
parenta38735c18e549af72449d7b9f6ec75f37479bdee (diff)
downloadcowboy-e92385038957dcda1429ee4fd93e921f3eb30f81.tar.gz
cowboy-e92385038957dcda1429ee4fd93e921f3eb30f81.tar.bz2
cowboy-e92385038957dcda1429ee4fd93e921f3eb30f81.zip
Use the new unique_integer function to generate IDs
In the eventsource example.
-rw-r--r--examples/eventsource/src/eventsource_handler.erl4
1 files changed, 1 insertions, 3 deletions
diff --git a/examples/eventsource/src/eventsource_handler.erl b/examples/eventsource/src/eventsource_handler.erl
index c896638..0e06ede 100644
--- a/examples/eventsource/src/eventsource_handler.erl
+++ b/examples/eventsource/src/eventsource_handler.erl
@@ -18,6 +18,4 @@ info({message, Msg}, Req, State) ->
{ok, Req, State}.
id() ->
- {Mega, Sec, Micro} = erlang:now(),
- Id = (Mega * 1000000 + Sec) * 1000000 + Micro,
- integer_to_list(Id, 16).
+ integer_to_list(erlang:unique_integer([positive, monotonic]), 16).