Skip to content

Instantly share code, notes, and snippets.

@jontonsoup
Last active August 29, 2015 14:11
Show Gist options
  • Save jontonsoup/2554e5dc4cd25c14823f to your computer and use it in GitHub Desktop.
Save jontonsoup/2554e5dc4cd25c14823f to your computer and use it in GitHub Desktop.
Mongo Service
21:40:59.077 [info] Started MongoService
21:40:59.077 [info] Started populating Urls
=INFO REPORT==== 22-Dec-2014::21:41:00 ===
application: logger
exited: stopped
type: temporary
=INFO REPORT==== 22-Dec-2014::21:41:00 ===
application: httpoison
exited: stopped
type: temporary
=INFO REPORT==== 22-Dec-2014::21:41:00 ===
application: hackney
exited: stopped
type: temporary
=INFO REPORT==== 22-Dec-2014::21:41:00 ===
application: idna
exited: stopped
type: temporary
** (Mix) Could not start application jobboard: exited in: JB.start(:normal, [])
** (EXIT) exited in: GenServer.call(:mongo_service, {:get, #Function<2.24609682/1 in MongoService.insert/2>}, 5000)
** (EXIT) no process
def start_link do
{:ok, pid} = Agent.start_link(fn ->
mongo = Mongo.connect!
db = mongo |> Mongo.db("simply_hired_urls")
collection = db |> Mongo.Db.collection("urls")
end,
name: :mongo_service)
Logger.info "Started MongoService"
{:ok, pid}
end
def insert(query, object) do
collection = Agent.get(:mongo_service, fn connection -> connection end)
Mongo.Collection.update(collection, query, object, true)
end
@jontonsoup
Copy link
Author

My error is:

** (Mix) Could not start application jobboard: exited in: JB.start(:normal, [])
** (EXIT) exited in: GenServer.call(:mongo_service, {:get, #Function<2.24609682/1 in MongoService.insert/2>}, 5000)
** (EXIT) no process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment