Skip to content

Commit a67e500

Browse files
Increase default sync timeout to 5 seconds
1 parent 15f9dcd commit a67e500

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Here are the options available for the browser factory:
151151
| ignoreCertificateErrors | false | Set chrome to ignore ssl errors |
152152
| keepAlive | true | true to keep alive the chrome instance when the script terminates |
153153
| noSandbox | false | Useful to run in a docker container |
154-
| sendSyncDefaultTimeout | 3000 | Default timeout (ms) for sending sync messages |
154+
| sendSyncDefaultTimeout | 5000 | Default timeout (ms) for sending sync messages |
155155
| startupTimeout | 30 | Maximum time in seconds to wait for chrome to start |
156156
| userAgent | none | User agent to use for the whole browser (see page api for alternative) |
157157
| userDataDir | none | chrome user data dir (default: a new empty dir is generated temporarily) |

src/Browser/BrowserProcess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function start($binary, $options)
140140
$this->logger->debug('process: connecting using ' . $this->wsUri);
141141

142142
// connect to browser
143-
$connection = new Connection($this->wsUri, $this->logger, $options['sendSyncDefaultTimeout'] ?? 3000);
143+
$connection = new Connection($this->wsUri, $this->logger, $options['sendSyncDefaultTimeout'] ?? 5000);
144144
$connection->connect();
145145

146146
// connection delay

src/BrowserFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(string $chromeBinary = null)
4141
* - ignoreCertificateErrors: set chrome to ignore ssl errors
4242
* - keepAlive: true to keep alive the chrome instance when the script terminates (default: false)
4343
* - noSandbox: enable no sandbox mode (default: false)
44-
* - sendSyncDefaultTimeout: maximum time in ms to wait for synchronous messages to send (default 3000 ms)
44+
* - sendSyncDefaultTimeout: maximum time in ms to wait for synchronous messages to send (default 5000 ms)
4545
* - startupTimeout: maximum time in seconds to wait for chrome to start (default: 30 sec)
4646
* - userAgent: user agent to use for the browser
4747
* - userDataDir: chrome user data dir (default: a new empty dir is generated temporarily)
@@ -118,7 +118,7 @@ public function getChromeVersion()
118118
* @param array $options options when creating the connection to the browser:
119119
* - connectionDelay: amount of time in seconds to slows down connection for debugging purposes (default: none)
120120
* - debugLogger: resource string ("php://stdout"), resource or psr-3 logger instance (default: none)
121-
* - sendSyncDefaultTimeout: maximum time in ms to wait for synchronous messages to send (default 3000 ms)
121+
* - sendSyncDefaultTimeout: maximum time in ms to wait for synchronous messages to send (default 5000 ms)
122122
*
123123
* @return Browser
124124
* @throws BrowserConnectionFailed
@@ -132,7 +132,7 @@ public static function connectToBrowser(string $uri, array $options = []): Brows
132132
}
133133

134134
// connect to browser
135-
$connection = new Connection($uri, $logger, $options['sendSyncDefaultTimeout'] ?? 3000);
135+
$connection = new Connection($uri, $logger, $options['sendSyncDefaultTimeout'] ?? 5000);
136136

137137
// try to connect
138138
try {

src/Communication/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function __construct($socketClient, LoggerInterface $logger = null, int $
9191
$this->setLogger($logger ?? new NullLogger());
9292

9393
// set timeout
94-
$this->sendSyncDefaultTimeout = $sendSyncDefaultTimeout ?? 3000;
94+
$this->sendSyncDefaultTimeout = $sendSyncDefaultTimeout ?? 5000;
9595

9696
// create socket client
9797
if (is_string($socketClient)) {

0 commit comments

Comments
 (0)