Skip to content

Commit 63bbd2e

Browse files
authored
Increase connect, read and write timeouts to 30 seconds (#31)
1 parent fc1dd0b commit 63bbd2e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
### Added
2525
- No new features!
2626
### Changed
27-
- No changed features!
27+
- Increase connect, read and write timeouts to 30 seconds
2828
### Deprecated
2929
- No deprecated features!
3030
### Removed

src/main/kotlin/com/hyperdevs/poeditor/gradle/PoEditorStringsImporter.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import okhttp3.logging.HttpLoggingInterceptor
3434
import retrofit2.Retrofit
3535
import retrofit2.converter.moshi.MoshiConverterFactory
3636
import java.util.*
37+
import java.util.concurrent.TimeUnit
3738

3839
/**
3940
* Main class that does the XML download, parsing and saving from PoEditor files.
@@ -46,7 +47,13 @@ object PoEditorStringsImporter {
4647
.add(Date::class.java, DateJsonAdapter())
4748
.build()
4849

50+
private const val CONNECT_TIMEOUT_SECONDS = 30L
51+
private const val READ_TIMEOUT_SECONDS = 30L
52+
private const val WRITE_TIMEOUT_SECONDS = 30L
4953
private val okHttpClient = OkHttpClient.Builder()
54+
.connectTimeout(CONNECT_TIMEOUT_SECONDS, TimeUnit.SECONDS)
55+
.readTimeout(READ_TIMEOUT_SECONDS, TimeUnit.SECONDS)
56+
.writeTimeout(WRITE_TIMEOUT_SECONDS, TimeUnit.SECONDS)
5057
.addInterceptor(HttpLoggingInterceptor(object : HttpLoggingInterceptor.Logger {
5158
override fun log(message: String) {
5259
logger.debug(message)

0 commit comments

Comments
 (0)