Skip to content

Commit

Permalink
[webhooks] add http timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
capcom6 committed Jun 24, 2024
1 parent 453772c commit 83926f0
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.google.gson.JsonObject
import io.ktor.client.HttpClient
import io.ktor.client.engine.okhttp.OkHttp
import io.ktor.client.plugins.DefaultRequest
import io.ktor.client.plugins.HttpTimeout
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
import io.ktor.client.request.post
import io.ktor.client.request.setBody
Expand Down Expand Up @@ -87,6 +88,11 @@ class SendWebhookWorker(appContext: Context, params: WorkerParameters) :
}

private val client = HttpClient(OkHttp) {
install(HttpTimeout) {
requestTimeoutMillis = 30000
connectTimeoutMillis = 5000
socketTimeoutMillis = 5000
}
install(ContentNegotiation) {
gson {
configure()
Expand Down

0 comments on commit 83926f0

Please sign in to comment.