Core/src/LongRunning/LongRunningOperation.php
public function pollUntilComplete(array $options = [])
    {
        $options += [
            'pollingIntervalSeconds' => $this::WAIT_INTERVAL,
            'maxPollingDurationSeconds' => 0.0,
        ];

        $pollingIntervalMicros = $options['pollingIntervalSeconds'] * 1000000;
        $maxPollingDuration = $options['maxPollingDurationSeconds'];
        $hasMaxPollingDuration = $maxPollingDuration > 0.0;
        $endTime = microtime(true) + $maxPollingDuration;

        do {
            usleep($pollingIntervalMicros);
            $this->reload($options);
        } while (!$this->done() && (!$hasMaxPollingDuration || microtime(true) < $endTime));

        return $this->result;
    }
public function pollUntilComplete(array $options = [])
    {
        $options += [
            'pollingIntervalSeconds' => $this::WAIT_INTERVAL,
            'maxPollingDurationSeconds' => 0.0,
        ];

        $pollingIntervalMicros = $options['pollingIntervalSeconds'] * 1000000;
        $maxPollingDuration = $options['maxPollingDurationSeconds'];
        $hasMaxPollingDuration = $maxPollingDuration > 0.0;
        $endTime = microtime(true) + $maxPollingDuration;

        do {
            usleep($pollingIntervalMicros);
            $this->reload($options);
        } while (!$this->done() && (!$hasMaxPollingDuration || microtime(true) < $endTime));

        return $this->result;
    }
public function pollUntilComplete ( array $ options = [ ] ) { $ options += [ 'pollingIntervalSeconds' => $ this :: WAIT_INTERVAL , 'maxPollingDurationSeconds' => 0.0 , ] ; $ pollingIntervalMicros = $ options [ 'pollingIntervalSeconds' ] * 1000000 ; $ maxPollingDuration = $ options [ 'maxPollingDurationSeconds' ] ; $ hasMaxPollingDuration = $ maxPollingDuration > 0.0 ; $ endTime = microtime ( true ) + $ maxPollingDuration ; do { usleep ( $ pollingIntervalMicros ) ; $ this -> reload ( $ options ) ; } while ( ! $ this -> done ( ) && ( ! $ hasMaxPollingDuration || microtime ( true ) < $ endTime ) ) ; return $ this -> result ; }
Reload the operation until it is complete.

The return type of this method is dictated by the type of Operation. If
`$options.maxPollingDurationSeconds` is set, and the poll exceeds the
limit, the return will be `null`.

Example:
```
$result = $operation->pollUntilComplete();
```

@param array $options {
Configuration Options

@type float $pollingIntervalSeconds The polling interval to use, in
seconds. **Defaults to** `1.0`.
@type float $maxPollingDurationSeconds The maximum amount of time to
continue polling. **Defaults to** `0.0`.
}
@return mixed|null
Reload the operation until it is complete .