MultipleClientKtorRequestsExecutor

class MultipleClientKtorRequestsExecutor(telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, callsFactories: List<KtorCallFactory>, excludeDefaultFactories: Boolean, requestsLimiter: RequestLimiter, jsonFormatter: Json, pipelineStepsHolder: KtorPipelineStepsHolder, requestExecutorsCount: Int, logger: KSLog, clientFactory: () -> HttpClient) : BaseRequestsExecutor

Will use its parameters of constructor to create several DefaultKtorRequestsExecutor and use them in execute and close operations

This BaseRequestsExecutor has been created for LinuxX64 target due to its inability of requests paralleling

Under the hood on each execute it will take DefaultKtorRequestsExecutor and mark it as busy, execute Request, free up taken DefaultKtorRequestsExecutor and return (or throw) the result of execution

Parameters

requestExecutorsCount

Amount of DefaultKtorRequestsExecutor which will be created and used under the hood

Constructors

Link copied to clipboard
constructor(telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, callsFactories: List<KtorCallFactory>, excludeDefaultFactories: Boolean, requestsLimiter: RequestLimiter, jsonFormatter: Json, pipelineStepsHolder: KtorPipelineStepsHolder, requestExecutorsCount: Int, logger: KSLog, clientFactory: () -> HttpClient)

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open suspend override fun <T : Any> execute(request: Request<T>): T

Unsafe execution of incoming request. Can throw almost any exception. So, it is better to use something like dev.inmo.tgbotapi.extensions.utils.shortcuts.executeAsync or dev.inmo.tgbotapi.extensions.utils.shortcuts.executeUnsafe