Skip to content

Commit c7a2f59

Browse files
committed
No more assertion on 0 retries options
closes tarantoolgh-83
1 parent d62eb1a commit c7a2f59

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/tarantool.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ PHP_INI_BEGIN()
117117
STD_PHP_INI_ENTRY("tarantool.request_timeout", "3600.0", PHP_INI_ALL,
118118
OnUpdateReal, request_timeout, zend_tarantool_globals,
119119
tarantool_globals)
120-
STD_PHP_INI_ENTRY("tarantool.retry_count", "1", PHP_INI_ALL,
120+
STD_PHP_INI_ENTRY("tarantool.retry_count", "0", PHP_INI_ALL,
121121
OnUpdateLong, retry_count, zend_tarantool_globals,
122122
tarantool_globals)
123123
STD_PHP_INI_ENTRY("tarantool.retry_sleep", "10", PHP_INI_ALL,
@@ -251,7 +251,9 @@ static int __tarantool_connect(tarantool_object *t_obj) {
251251
TSRMLS_FETCH();
252252
tarantool_connection *obj = t_obj->obj;
253253
int status = SUCCESS;
254-
long count = TARANTOOL_G(retry_count);
254+
/* retry_count always 1 more than count of tries, since retry count
255+
* is number of retries*/
256+
long count = TARANTOOL_G(retry_count) + 1;
255257
struct timespec sleep_time = {0};
256258
double_to_ts(INI_FLT("retry_sleep"), &sleep_time);
257259
char *err = NULL;

test/CreateTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,15 @@ public static function provideGoodCredentials()
152152
['guest', null],
153153
];
154154
}
155+
}
156+
157+
public function test_10_zero_retry_exception() {
158+
$t = static::connectTarantool();
159+
$rc = ini_get('tarantool.retry_count');
160+
161+
ini_set('tarantool.retry_count', 0);
162+
$this->assertEquals($t->ping(), true);
163+
ini_set('tarantool.retry_count', $rc);
164+
}
155165
}
156166

0 commit comments

Comments
 (0)