This commit is contained in:
Andrea Cavalli 2022-01-11 16:00:56 +01:00
parent 735fccf043
commit 07c1e6c836
2 changed files with 14 additions and 4 deletions

13
pom.xml
View File

@ -48,7 +48,7 @@
<dependency>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-java-bom</artifactId>
<version>2.8.0.1</version>
<version>2.8.0.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -109,6 +109,12 @@
<groupId>io.atomix</groupId>
<artifactId>atomix</artifactId>
<version>${atomix.version}</version>
<exclusions>
<exclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.atomix</groupId>
@ -120,6 +126,11 @@
<artifactId>atomix-primary-backup</artifactId>
<version>${atomix.version}</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.2</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>

View File

@ -134,14 +134,13 @@ public abstract class ReactiveApiPublisher {
return transformedFlux;
})
.publish();
.publish(256);
publishedResultingEvents
// Obtain only TDLib-bound events
.filter(s -> s instanceof TDLibBoundResultingEvent<?>)
.map(s -> ((TDLibBoundResultingEvent<?>) s).action())
.limitRate(4)
// Buffer up to 64 requests to avoid halting the event loop, throw an error if too many requests are buffered
.onBackpressureBuffer(64, BufferOverflowStrategy.ERROR)
@ -159,7 +158,7 @@ public abstract class ReactiveApiPublisher {
.doOnError(ex -> LOG.error("Failed to receive the response for special request {}\n"
+ " The instance will be closed", function, ex))
.onErrorResume(ex -> Mono.just(new OnUpdateError(liveId, userId, new TdApi.Error(500, ex.getMessage()))))
)
, 1024)
.doOnError(ex -> LOG.error("Failed to receive resulting events. The instance will be closed", ex))
.onErrorResume(ex -> Mono.just(new OnUpdateError(liveId, userId, new TdApi.Error(500, ex.getMessage()))))