Skip to content

Commit c73d3b9

Browse files
committed
No more assertion on 0 retries options
closes tarantoolgh-83
1 parent 21f638b commit c73d3b9

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-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,
@@ -252,7 +252,9 @@ static int __tarantool_connect(tarantool_object *t_obj) {
252252
TSRMLS_FETCH();
253253
tarantool_connection *obj = t_obj->obj;
254254
int status = SUCCESS;
255-
long count = TARANTOOL_G(retry_count);
255+
/* retry_count always 1 more than count of tries, since retry count
256+
* is number of retries*/
257+
long count = TARANTOOL_G(retry_count) + 1;
256258
struct timespec sleep_time = {0};
257259
double_to_ts(INI_FLT("retry_sleep"), &sleep_time);
258260
char *err = NULL;

test/CreateTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,14 @@ public static function provideGoodCredentials()
163163
['guest', null],
164164
];
165165
}
166+
167+
public function test_10_zero_retry_exception() {
168+
$t = static::connectTarantool();
169+
$rc = ini_get('tarantool.retry_count');
170+
171+
ini_set('tarantool.retry_count', 0);
172+
$this->assertEquals($t->ping(), true);
173+
ini_set('tarantool.retry_count', $rc);
174+
}
166175
}
167176

0 commit comments

Comments
 (0)