Update AsyncTdDirectImpl.java

This commit is contained in:
Andrea Cavalli 2021-01-24 23:24:13 +01:00
parent 6bd8f6281b
commit ab70ca31ef
1 changed files with 2 additions and 2 deletions

View File

@ -74,7 +74,7 @@ public class AsyncTdDirectImpl implements AsyncTdDirect {
return telegramClientFactory.create(implementationDetails)
.flatMapMany(client -> Flux
.<TdApi.Object>create(updatesSink -> {
client.initialize((TdApi.Object object) -> {
Schedulers.boundedElastic().schedule(() -> client.initialize((TdApi.Object object) -> {
updatesSink.next(object);
// Close the emitter if receive closed state
if (object.getConstructor() == UpdateAuthorizationState.CONSTRUCTOR
@ -84,7 +84,7 @@ public class AsyncTdDirectImpl implements AsyncTdDirect {
closedFromTd.tryEmitValue(true);
updatesSink.complete();
}
}, updatesSink::error, updatesSink::error);
}, updatesSink::error, updatesSink::error));
if (td.tryEmitValue(client).isFailure()) {
updatesSink.error(new TdError(500, "Failed to emit td client"));