Skip to content
Merged
Changes from all commits
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
9 changes: 8 additions & 1 deletion legacy/src/Service/ActivityMonitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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));
}
Expand Down
Loading