Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd7afaad

Browse files
committed
allow zero (infinite) 'max_attempts' in poll_query_until()
1 parent15ccedb commitd7afaad

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎testgres/testgres.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -922,20 +922,25 @@ def poll_query_until(self,
922922
raise_internal_error=True):
923923
"""
924924
Run a query once a second until it returs 'expected'.
925+
Query should return single column.
925926
926927
Args:
927928
dbname: database name to connect to.
928929
query: query to be executed.
929930
username: database user name.
930-
max_attempts: how many times should we try?
931-
sleep_time: howlong should we sleep after a failure?
931+
max_attempts: how many times should we try? 0 == infinite
932+
sleep_time: howmuch should we sleep after a failure?
932933
expected: what should be returned to break the cycle?
933934
raise_programming_error: mute ProgrammingError?
934935
raise_internal_error: mute InternalError?
935936
"""
936937

938+
# sanity checks
939+
assert(max_attempts>=0)
940+
assert(sleep_time>0)
941+
937942
attempts=0
938-
whileattempts<max_attempts:
943+
whilemax_attempts==0orattempts<max_attempts:
939944
try:
940945
res=self.execute(dbname=dbname,
941946
query=query,
@@ -1010,7 +1015,7 @@ def replicate(self, name, username=None,
10101015
xlog_method=DEFAULT_XLOG_METHOD,
10111016
use_logging=False):
10121017
"""
1013-
Create a replica of this node.
1018+
Create abinaryreplica of this node.
10141019
10151020
Args:
10161021
name: replica's name.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp