Merge branch 'hotfix/21.56.9' into master
[gitter.git] / modules / presence / redis-lua / presence-disassociate-anon.lua
blobcc66c587ef2b372a4b67f155cc0da46e7962b93f
1 local key_socket = KEYS[1];
2 local key_active_sockets = KEYS[2];
3 local key_user_sockets = KEYS[3];
5 local socket_id = ARGV[1];
7 local socket_del_result = redis.call("SREM", key_active_sockets, socket_id)
8 redis.call("SREM", key_user_sockets, socket_id)
10 -- If the socket doesn't exist, return with a failure code
11 if redis.call("EXISTS", key_socket) == 0 then
12 return { 0, socket_del_result }
13 end
16 redis.call("DEL", key_socket)
18 return { 1, socket_del_result }