aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-11-09 13:52:41 +0100
committerAlex Auvolat <alex@adnab.me>2018-11-09 13:52:41 +0100
commitf09f6cfb6850eac8a75b776d0f474a9ecb57f4fa (patch)
tree34e09cce0637a59531845b3048cd63327fdd2b24
parentc0804534ac323b1162d3d394eda6838f63e0a582 (diff)
downloadshard-master.tar.gz
shard-master.zip
add logsHEADmaster
-rw-r--r--shard/lib/manager.ex8
1 files changed, 6 insertions, 2 deletions
diff --git a/shard/lib/manager.ex b/shard/lib/manager.ex
index efa9189..ab73b68 100644
--- a/shard/lib/manager.ex
+++ b/shard/lib/manager.ex
@@ -99,12 +99,14 @@ defmodule Shard.Manager do
[{^shard_id, manifest, {:cached, _}, _}] ->
pid = case :ets.lookup(:shard_procs, {shard_id, nil}) do
[] ->
+ Logger.info("Starting #{ShardURI.from_manifest manifest} for deletion")
{:ok, pid} = apply(Shard.Manifest.module(manifest), :start_link, [manifest])
pid
[{{^shard_id, nil}, pid}] ->
:ets.delete(:shard_procs, {shard_id, nil})
pid
end
+ Logger.info("Deleting #{ShardURI.from_manifest manifest}")
GenServer.call(pid, :delete_shard)
:dets.delete(@shard_db, shard_id)
{:reply, :ok, state}
@@ -196,11 +198,12 @@ defmodule Shard.Manager do
currtime = System.os_time :seconds
shards = :dets.select(@shard_db, [{
- {:'$1', :_, {:cached, :'$2'}, :_}, [{:<, :'$2', currtime}], [:'$1']}
+ {:'$1', :'$2', {:cached, :'$3'}, :_}, [{:<, :'$3', currtime}], [:'$1', :'$2']}
])
- for [id] <- shards do
+ for [id, manifest] <- shards do
case :ets.lookup(:shard_procs, {id, nil}) do
[{{^id, nil}, pid}] ->
+ Logger.info("Deleting expired #{ShardURI.from_manifest manifest}")
GenServer.call(pid, :delete_shard)
_ -> nil
end
@@ -238,6 +241,7 @@ defmodule Shard.Manager do
case :ets.lookup(:shard_procs, {shard_id, nil}) do
[] ->
+ Logger.info("Starting #{ShardURI.from_manifest manifest}")
{:ok, pid} = apply(Shard.Manifest.module(manifest), :start_link, [manifest])
GenServer.cast(pid, :send_deps)
:ets.insert(:shard_procs, {{shard_id, nil}, pid})