aboutsummaryrefslogtreecommitdiff
path: root/shard/lib
diff options
context:
space:
mode:
Diffstat (limited to 'shard/lib')
-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})