Skip to content

Commit 76ded83

Browse files
authored
feat: don't wait a whole second for DDL polling when using emulator (#285)
* faster DDL exec * maxPollingDurationSeconds’ default is 0.0
1 parent 2d83177 commit 76ded83

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Concerns/ManagesDataDefinitions.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,18 @@ public function databaseExists()
9696
*/
9797
protected function waitForOperation(LongRunningOperation $operation): mixed
9898
{
99-
$result = $operation->pollUntilComplete(['maxPollingDurationSeconds' => 0.0]);
99+
$options = [];
100+
101+
if (getenv('SPANNER_EMULATOR_HOST')) {
102+
$options['pollingIntervalSeconds'] = 0.001;
103+
}
104+
105+
$result = $operation->pollUntilComplete($options);
106+
100107
if ($operation->error() !== null) {
101108
throw new RuntimeException((string) json_encode($operation->error()));
102109
}
110+
103111
return $result;
104112
}
105113
}

0 commit comments

Comments
 (0)