diff --git a/legacy/src/Service/ActivityMonitor.php b/legacy/src/Service/ActivityMonitor.php index f983fb05..bc4afef2 100644 --- a/legacy/src/Service/ActivityMonitor.php +++ b/legacy/src/Service/ActivityMonitor.php @@ -685,6 +685,13 @@ private function getLogStream(Activity $activity, ProgressBar $bar) { $url = $activity->getLink('log'); + // Strip any query string from the URL. The log link can inherit query + // parameters (such as "count") from the base activities collection + // URL, and those are rejected by the log endpoint with HTTP 400. + if (($queryPos = \strpos($url, '?')) !== false) { + $url = \substr($url, 0, $queryPos); + } + // Try fetching the stream with a 10 second timeout per call, and a .5 // second interval between calls, for up to 2 minutes. $readTimeout = 10; @@ -705,7 +712,7 @@ private function getLogStream(Activity $activity, ProgressBar $bar) throw new \RuntimeException('Failed to open activity log stream: ' . $url); } $bar->advance(); - \usleep((int) $interval * 1000000); + \usleep((int) ($interval * 1000000)); $bar->advance(); $stream = \fopen($url, 'r', false, $this->api->getStreamContext($readTimeout)); }