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 local eyeball_lock
= redis
.call("HSETNX", key_socket
, "eb", 1)
9 if eyeball_lock
== 0 then
13 redis
.call("INCR", key_user_lock
);
14 redis
.call("EXPIRE", key_user_lock
, 10);
16 local in_troupe_count
= redis
.call("ZINCRBY", key_troupe_users
, 1, user_id
)
18 return { eyeball_lock
, in_troupe_count
}