Skip to content

Commit a3762c4

Browse files
Tieskethibaultcha
authored andcommitted
feat(cluster) new argument to concensus check to override timeout
Add an override option to the `wait_schema_consensus` to override the default timeout. From #102
1 parent 89e90c0 commit a3762c4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/resty/cassandra/cluster.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,8 @@ local function check_schema_consensus(coordinator)
578578
return local_res[1].schema_version
579579
end
580580

581-
local function wait_schema_consensus(self, coordinator)
581+
local function wait_schema_consensus(self, coordinator, timeout)
582+
timeout = timeout or self.max_schema_consensus_wait
582583
local peers, err = get_peers(self)
583584
if err then return nil, err
584585
elseif not peers then return nil, 'no peers in shm'
@@ -598,7 +599,7 @@ local function wait_schema_consensus(self, coordinator)
598599
update_time()
599600
ok, err = check_schema_consensus(coordinator)
600601
tdiff = get_now() - tstart
601-
until ok or err or tdiff >= self.max_schema_consensus_wait
602+
until ok or err or tdiff >= timeout
602603

603604
if ok then
604605
return ok

0 commit comments

Comments
 (0)