Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
Fix node deletion by token (fixes #27)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmolitor-stud-tu committed Feb 20, 2020
1 parent b759669 commit 3d1e20a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mod_push_appserver/mod_push_appserver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ local push_store = (function()
return store:users();
end
function api:token2node(token)
if token2node_cache[token] then return token2node_cache[token].node; end
if token2node_cache[token] then return token2node_cache[token]; end
for node in store:users() do
local err;
-- read data directly, we don't want to cache full copies of stale entries as api:get() would do
Expand All @@ -92,7 +92,7 @@ local push_store = (function()
end
if settings.token and settings.node then token2node_cache[settings.token] = settings.node; end
end
if token2node_cache[token] then return token2node_cache[token].node; end
if token2node_cache[token] then return token2node_cache[token]; end
return nil;
end
return api;
Expand Down Expand Up @@ -288,7 +288,7 @@ local function unregister_push_node(node, type)
push_store:set(node, nil);
throttles[node] = nil;
module:log("info", "Unregistered push device, returning: 'OK', '%s', '%s'", tostring(node), tostring(settings["secret"]));
module:log("debug", "settings: %s", pretty.write(settings));
module:log("debug", "settings were: %s", pretty.write(settings));
return "OK\n"..node.."\n"..settings["secret"];
end

Expand Down

0 comments on commit 3d1e20a

Please sign in to comment.