Skip to content

Commit e6e81ee

Browse files
committed
Use ImmediateScheduler for CutOperator on streams
1 parent 2620f86 commit e6e81ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/AsyncStreamingClient.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Rx\Observable;
1212
use Rx\Operator\CutOperator;
1313
use Rx\React\Promise;
14+
use Rx\Scheduler\ImmediateScheduler;
1415

1516
final class AsyncStreamingClient implements AsyncStreamingClientInterface
1617
{
@@ -60,7 +61,7 @@ protected function stream(RequestInterface $request): Observable
6061
return Promise::toObservable($this->client->handle(new StreamingRequestCommand(
6162
$request
6263
)))->switchLatest()->lift(function () {
63-
return new CutOperator(self::STREAM_DELIMITER);
64+
return new CutOperator(self::STREAM_DELIMITER, new ImmediateScheduler());
6465
})->filter(function (string $json) {
6566
return trim($json) !== ''; // To keep the stream alive Twitter sends an empty line at times
6667
})->_ApiClients_jsonDecode()->flatMap(function (array $document) {

0 commit comments

Comments
 (0)