Skip to content

Commit c83f4a3

Browse files
author
Илья
committed
Added timeout and canceled params
1 parent 4a4b30f commit c83f4a3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Session.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,13 +370,19 @@ public function query($yql, array $parameters = null, array $options = [])
370370
}
371371
$operationParams = new OperationParams();
372372
if(isset($options['operation_timeout_ms'])){
373+
$seconds = intdiv( $options['operation_timeout_ms'], 1000); // get seconds
374+
$nanos = $options['operation_timeout_ms'] % 1000 * 1000000; // get ns
373375
$operationParams->setOperationTimeout(new Duration([
374-
'nanos' => $options['operation_timeout_ms'] * 1000000 // convert ms to ns
376+
'seconds' => $seconds,
377+
'nanos' => $nanos
375378
]));
376379
}
377380
if(isset($options['cancel_after_ms'])){
381+
$seconds = intdiv( $options['cancel_after_ms'], 1000); // get seconds
382+
$nanos = $options['cancel_after_ms'] % 1000 * 1000000; // get ns
378383
$operationParams->setCancelAfter(new Duration([
379-
'nanos' => $options['cancel_after_ms'] * 1000000 // convert ms to ns
384+
'seconds' => $seconds,
385+
'nanos' => $nanos
380386
]));
381387
}
382388
$query->operationParams($operationParams);

0 commit comments

Comments
 (0)