Skip to content

Commit e7158aa

Browse files
committed
removed some warnings
1 parent 3c9b6cd commit e7158aa

File tree

6 files changed

+9
-21
lines changed

6 files changed

+9
-21
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
* Bugfixes
1111
* Using `max_staleness_ms` > 0 results in a crash
12-
12+
* Read preferences are sent to mongos
13+
1314
## 0.6.5
1415

1516
* Enhancements

lib/mongo.ex

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,11 @@ defmodule Mongo do
5252

5353
use Bitwise
5454
use Mongo.Messages
55+
5556
alias Mongo.Query
56-
alias Mongo.ReadPreference
5757
alias Mongo.Topology
5858
alias Mongo.UrlParser
5959
alias Mongo.Session
60-
alias Mongo.ReadPreference
6160
alias Mongo.Events
6261
alias Mongo.Events.CommandSucceededEvent
6362
alias Mongo.Events.CommandFailedEvent
@@ -144,16 +143,12 @@ defmodule Mongo do
144143
|> Topology.start_link()
145144
end
146145

147-
def child_spec(opts, child_opts \\ []) do
148-
Supervisor.Spec.worker(Mongo, [opts], child_opts)
149-
end
150-
151146
@doc """
152147
Generates a new `BSON.ObjectId`.
153148
"""
154149
@spec object_id :: BSON.ObjectId.t
155150
def object_id do
156-
Mongo.IdServer.new
151+
Mongo.IdServer.new()
157152
end
158153

159154
@doc """

lib/mongo/app.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ defmodule Mongo.App do
55
import Supervisor.Spec, warn: false
66

77
children = [
8-
worker(Mongo.IdServer, []),
9-
worker(Mongo.PBKDF2Cache, []),
8+
{Mongo.IdServer, []},
9+
{Mongo.PBKDF2Cache, []},
1010
supervisor(Registry, [:duplicate, :events_registry])
1111
]
1212

lib/mongo/id_server.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ defmodule Mongo.IdServer do
8484
end
8585

8686
defp process_id() do
87-
:os.getpid |> List.to_integer()
87+
:os.getpid() |> List.to_integer()
8888
end
8989
end

lib/mongo/monitor.ex

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,8 @@ defmodule Mongo.Monitor do
163163
end
164164

165165
defp call_is_master_command(conn_pid, opts) do
166-
167166
{rtt, result} = :timer.tc(fn -> Mongo.exec_command(conn_pid, [isMaster: 1], opts) end)
168-
169-
finish_time = DateTime.utc_now()
170-
#start_time = System.monotonic_time
171-
#result = Mongo.exec_command(conn_pid, [isMaster: 1], opts)
172-
#finish_time = System.monotonic_time
173-
#rtt = System.convert_time_unit(finish_time - start_time, :native, :millisecond)
174-
#finish_time = System.convert_time_unit(finish_time, :native, :millisecond)
175-
167+
finish_time = DateTime.utc_now()
176168
{result, finish_time, div(rtt, 1000)}
177169
end
178170

lib/utils.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ defmodule Mongo.Utils do
2222
# Inserts an ID to the document. A distinction is made as to whether binaries or atoms are used as keys.
2323
#
2424
defp add_id(doc) do
25-
id = Mongo.IdServer.new
25+
id = Mongo.IdServer.new()
2626
{id, add_id(doc, id)}
2727
end
2828
defp add_id([{key, _}|_] = list, id) when is_atom(key), do: [{:_id, id}|list]

0 commit comments

Comments
 (0)