Skip to content

Commit

Permalink
Merge pull request #55 from ShaneWilton/quinn/54
Browse files Browse the repository at this point in the history
Normalize time units as their singular, non-underscored versions
  • Loading branch information
Mustafa TURAN authored Aug 25, 2018
2 parents 306c7de + c00e6ef commit f9cd268
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Add more test for unsubscribe/1
- Add questions section
- Change default `@eb_tme_unit` to `:microsecond`
- Change all instances of `micro_seconds` and `microseconds` to `microsecond`, as per Erlang 19+

## [1.3.X]

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ It is recommended to set optional params in event_bus application config, this w
config :event_bus,
topics: [], # list of atoms
ttl: 30_000_000, # integer
time_unit: :micro_seconds, # atom
time_unit: :microsecond, # atom
id_generator: EventBus.Util.Base62 # module: must implement 'unique_id/0' function
```

Expand Down
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ use Mix.Config
config :event_bus,
topics: [:metrics_received, :metrics_summed],
ttl: 30_000_000,
time_unit: :micro_seconds,
time_unit: :microsecond,
id_generator: EventBus.Util.String
4 changes: 2 additions & 2 deletions lib/event_bus/utils/base62.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ defmodule EventBus.Util.Base62 do
|> String.pad_leading(size, "0")
end

# Current time (microseconds) encoded in base62
# Current time (microsecond) encoded in base62
defp now do
encode(System.os_time(:microseconds))
encode(System.os_time(:microsecond))
end

# Assigns a random node_id on first call
Expand Down
4 changes: 2 additions & 2 deletions test/event_bus/models/event_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule EventBus.Model.EventTest do
end

test "duration" do
initialized_at = System.os_time(:micro_seconds)
initialized_at = System.os_time(:microsecond)
# do sth in this frame
Process.sleep(1)

Expand All @@ -20,7 +20,7 @@ defmodule EventBus.Model.EventTest do
topic: "user_created",
data: %{id: 1, name: "me", email: "[email protected]"},
initialized_at: initialized_at,
occurred_at: System.os_time(:micro_seconds)
occurred_at: System.os_time(:microsecond)
}

assert Event.duration(event) > 0
Expand Down

0 comments on commit f9cd268

Please sign in to comment.