Spanner/src/Session/CacheSessionPool.php
private function createSessions($count)
    {
        $args = [
            'database' => $this->database->name(),
            'session' => [
                'labels' => isset($this->config['labels']) ? $this->config['labels'] : []
            ]
        ];

        $promises = [];

        for ($i = 0; $i < $count; $i++) {
            $promises[] = $this->database->connection()->createSessionAsync($args);
        }

        $results = Promise\settle($promises)->wait();

        $sessions = [];

        foreach ($results as $result) {
            if ($result['state'] === 'fulfilled') {
                $name = $result['value']->getName();
                $sessions[] = [
                    'name' => $name,
                    'expiration' => $this->time() + SessionPoolInterface::SESSION_EXPIRATION_SECONDS
                ];
            }
        }

        return $sessions;
    }
private function createSessions($count)
    {
        $args = [
            'database' => $this->database->name(),
            'session' => [
                'labels' => isset($this->config['labels']) ? $this->config['labels'] : []
            ]
        ];

        $promises = [];

        for ($i = 0; $i < $count; $i++) {
            $promises[] = $this->database->connection()->createSessionAsync($args);
        }

        $results = Promise\settle($promises)->wait();

        $sessions = [];

        foreach ($results as $result) {
            if ($result['state'] === 'fulfilled') {
                $name = $result['value']->getName();
                $sessions[] = [
                    'name' => $name,
                    'expiration' => $this->time() + SessionPoolInterface::SESSION_EXPIRATION_SECONDS
                ];
            }
        }

        return $sessions;
    }
private function createSessions ( $ count ) { $ args = [ 'database' => $ this -> database -> name ( ) , 'session' => [ 'labels' => isset ( $ this -> config [ 'labels' ] ) ? $ this -> config [ 'labels' ] : [ ] ] ] ; $ promises = [ ] ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ promises [ ] = $ this -> database -> connection ( ) -> createSessionAsync ( $ args ) ; } $ results = Promise \ settle ( $ promises ) -> wait ( ) ; $ sessions = [ ] ; foreach ( $ results as $ result ) { if ( $ result [ 'state' ] === 'fulfilled' ) { $ name = $ result [ 'value' ] -> getName ( ) ; $ sessions [ ] = [ 'name' => $ name , 'expiration' => $ this -> time ( ) + SessionPoolInterface :: SESSION_EXPIRATION_SECONDS ] ; } } return $ sessions ; }
Creates sessions up to the count provided.

@param int $count
@return array
Creates sessions up to the count provided .