Simple Multi Server Requests Executor
fun SimpleMultiServerRequestsExecutor( bots: List<TelegramBot>, botSelector: suspend List<TelegramBot>.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ ->
getOrElse(i + 1) { first() }
}, onClose: () -> Unit = {
bots.forEach(TelegramBot::close)
})
Content copied to clipboard
Parameters
bots
Bots which will be used to executes
bot Selector
It is strategy by which the bot is selected for the execution. This lambda will receive -1 when request execution just started and this call is first in context of one execute. By default, will select next TelegramBot when called (or first when current index is last or -1)
on Close
This method will be called inside of close method. By default, will close all bots