Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ public function testPingMethod()
'dsn' => env('MONGODB_URI', 'mongodb://127.0.0.1/'),
'database' => 'unittest',
'options' => [
'connectTimeoutMS' => 100,
'serverSelectionTimeoutMS' => 250,
'connectTimeoutMS' => 1000,
'serverSelectionTimeoutMS' => 1000,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest using a slightly higher value here, as it's intended to outlast a replica set election. Replica Set Elections still notes that an election should not exceed 12 seconds, but I think you'd be OK to just throw another zero on this and use 10. If that's still too much, I'd at least consider bumping it to 5 or 6 seconds.

But using the same value as connectTimeoutMS may send the wrong message to any users that come across this. The connection timeout should logically be a smaller value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I've set serverSelectionTimeoutMS to 6000ms.

],
];

Expand Down
4 changes: 2 additions & 2 deletions tests/config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
'dsn' => env('MONGODB_URI', 'mongodb://127.0.0.1/'),
'database' => env('MONGODB_DATABASE', 'unittest'),
'options' => [
'connectTimeoutMS' => 100,
'serverSelectionTimeoutMS' => 250,
'connectTimeoutMS' => 1000,
'serverSelectionTimeoutMS' => 1000,
],
],

Expand Down