From d8887bb7ff0a0a2955a43315a5bdb52ec4832394 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 23 Jul 2019 07:46:19 +0800 Subject: [PATCH] RequestsExecutor now is Closeable --- CHANGELOG.md | 2 ++ .../TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt | 4 ++++ .../insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 686a1be35a..54301c46b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ * Joda Time version `2.10.1` -> `2.10.3` * Ktor version `1.1.4` -> `1.2.2` +* `RequestsExecutor` now is `Closeable` + ## 0.16.0 Bot API 4.3 * `LoginURL` and `LoginURLInlineKeyboardButton` has been added diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt index 958b1bd33d..ff1b43eb56 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt @@ -83,4 +83,8 @@ class KtorRequestsExecutor( } } } + + override fun close() { + client.close() + } } diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt index e2eacbb377..c8e8c52010 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt @@ -2,8 +2,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.bot import com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions.RequestException import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request +import kotlinx.io.core.Closeable -interface RequestsExecutor { +interface RequestsExecutor : Closeable { @Throws(RequestException::class) suspend fun execute(request: Request): T } \ No newline at end of file