Skip to content

Commit

Permalink
Update elephantio to latest version and use 'wait' instead of 'drain'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gared committed Nov 6, 2024
1 parent f2baf74 commit 82ae18b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"ext-json": "*",
"guzzlehttp/guzzle": "^7.8",
"symfony/console": "^6.4|^7.0",
"elephantio/elephant.io": "4.8.*"
"elephantio/elephant.io": "^4.8"
},
"require-dev": {
"phpstan/phpstan": "^1.10"
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions src/Service/ScannerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,8 @@ private function doSocketWebsocket(
'protocolVersion' => 2,
]);

$expirationTime = microtime(true) + 2;

while (microtime(true) < $expirationTime) {
usleep(10000);
$result = $socketIoClient->drain();
if ($result !== null && is_array($result->data)) {
while ($result = $socketIoClient->wait('message', 2)) {
if (is_array($result->data)) {
$accessStatus = $result->data['accessStatus'] ?? null;
if ($accessStatus === 'deny') {
$callback->onScanPadException(new EtherpadServiceNotPublicException('Pads are not publicly accessible'));
Expand Down

0 comments on commit 82ae18b

Please sign in to comment.