Skip to content

Commit

Permalink
set default lease ttl to 10s
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorerlingsson committed Nov 20, 2024
1 parent c22056b commit a3576ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lavinmq/etcd.cr
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module LavinMQ
end

# Returns {ID, TTL}
def lease_grant(ttl = 5) : Tuple(Int64, Int32)
def lease_grant(ttl = 10) : Tuple(Int64, Int32)
json = post("/v3/lease/grant", body: %({"TTL":"#{ttl}"}))
ttl = json.dig("TTL").as_s.to_i
id = json.dig("ID").as_s.to_i64
Expand Down Expand Up @@ -80,7 +80,7 @@ module LavinMQ
# Campaign for an election
# Returns a Channel when elected leader,
# when the channel is closed the leadership is lost
def elect(name, value, ttl = 5) : Channel(Nil)
def elect(name, value, ttl = 10) : Channel(Nil)
channel = Channel(Nil).new
lease_id, ttl = lease_grant(ttl)
wg = WaitGroup.new(1)
Expand Down

0 comments on commit a3576ce

Please sign in to comment.