Skip to content

Commit 3c01213

Browse files
committed
Update
1 parent 7c71a46 commit 3c01213

File tree

4 files changed

+7
-23
lines changed

4 files changed

+7
-23
lines changed

examples/app/Commands/Select1Command.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Symfony\Component\Console\Input\InputArgument;
99
use Symfony\Component\Console\Input\InputInterface;
1010
use Symfony\Component\Console\Output\OutputInterface;
11+
use YdbPlatform\Ydb\Session;
1112
use YdbPlatform\Ydb\Ydb;
1213

1314
class Select1Command extends Command
@@ -44,11 +45,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
4445
{
4546
$ydb = $this->appService->initYdb();
4647

47-
$result = $ydb->retry(function (Ydb $ydb) use ($output) {
48+
$result = $ydb->table()->retrySession(function (Session $session) use ($output) {
4849

49-
$table = $ydb->table();
50-
51-
return $table->session()->query('select 1;');
50+
return $session->query('select 1;');
5251

5352
}, true);
5453

src/Session.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ public function newQuery($yql)
329329
*/
330330
public function executeQuery(YdbQuery $query)
331331
{
332-
$data = $query->getRequestData();
333332
$data = $query->getRequestData();
334333
$data['session_id'] = $this->session_id;
335334

tests/RetryOnExceptionTest.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static function getSessionId(\YdbPlatform\Ydb\Session $session){
1919
}
2020
}
2121

22-
class RetryOnBadSessionTest extends TestCase
22+
class RetryOnExceptionTest extends TestCase
2323
{
2424
/**
2525
* @var string
@@ -53,22 +53,10 @@ public function test(){
5353
$this->oldSessionId = SessionManager::getSessionId($session);
5454
$session->delete();
5555

56-
// $this->backwardCompatibility($table);
57-
5856
$this->retryTest($table);
5957

6058
}
6159

62-
private function backwardCompatibility(Table $table)
63-
{
64-
$session = $table->createSession();
65-
SessionManager::setSessionId($session, $this->oldSessionId);
66-
$tres = $session->query('select 1 as res')->rows()[0]['res'];
67-
self::assertEquals(
68-
1,
69-
$tres
70-
);
71-
}
7260

7361
private function retryTest(Table $table)
7462
{
@@ -81,6 +69,6 @@ private function retryTest(Table $table)
8169
1,
8270
$tres
8371
);
84-
}, false, new RetryParams(20000));
72+
}, true, new RetryParams(20000));
8573
}
8674
}

tests/RunTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ private function getYdbResult(array $config) : array
3737
{
3838
$ydb = new Ydb($config);
3939
$table = $ydb->table();
40-
$x = microtime(true);
40+
4141
$session = $table->createSession();
42-
print microtime(true)-$x;
43-
print "\n";
44-
print microtime(true);
42+
4543
$session->createTable(
4644
'episodes',
4745
YdbTable::make()

0 commit comments

Comments
 (0)