1 local key_socket
= KEYS
[1];
2 local key_troupe_users
= KEYS
[2];
3 local key_user_lock
= KEYS
[3];
5 local user_id
= ARGV
[1];
7 if redis
.call("HDEL", key_socket
, "eb") == 0 then
11 redis
.call("INCR", key_user_lock
);
12 redis
.call("EXPIRE", key_user_lock
, 10);
15 local user_in_troupe_count
= redis
.call("ZINCRBY", key_troupe_users
, -1, user_id
)
16 redis
.call("ZREMRANGEBYSCORE", key_troupe_users
, '-inf', '0')
18 local total_in_troupe_count
= redis
.call("ZCARD", key_troupe_users
)
20 return { 1, user_in_troupe_count
, total_in_troupe_count
}