Skip to content

Commit

Permalink
add todo in rwlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Heiss committed Oct 28, 2023
1 parent 514e28f commit 04b637f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/redis/rwlock/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ return 1
/// 1. The key to lock
/// 2. The uuid of the lock
/// 3. The timeout in seconds for waiting
// TODO: Should lock be expanded, if there is already another writer waiting?
pub const WRITER_LOCK: &str = r#"
redis.call("setex", ARGV[1] .. ":writer_waiting_list:" .. ARGV[2], ARGV[3], 1)
redis.call("set", ARGV[1] .. ":writer_waiting_list:" .. ARGV[2], 1, "ex", ARGV[3])
if redis.call("exists", ARGV[1] .. ":lock") == 1 then
return 0
end
Expand Down

0 comments on commit 04b637f

Please sign in to comment.