File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
app/src/main/java/com/sirelon/marsroverphotos/network Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import com.sirelon.marsroverphotos.models.PhotosQueryRequest
11
11
import com.sirelon.marsroverphotos.storage.MarsImage
12
12
import io.ktor.client.HttpClient
13
13
import io.ktor.client.engine.okhttp.OkHttp
14
+ import io.ktor.client.plugins.HttpTimeout
14
15
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
15
16
import io.ktor.client.plugins.defaultRequest
16
17
import io.ktor.serialization.kotlinx.json.json
@@ -20,6 +21,7 @@ import kotlinx.coroutines.flow.filterNotNull
20
21
import kotlinx.serialization.ExperimentalSerializationApi
21
22
import kotlinx.serialization.json.Json
22
23
import okhttp3.logging.HttpLoggingInterceptor
24
+ import java.util.concurrent.TimeUnit
23
25
24
26
/* *
25
27
* @author romanishin
@@ -59,6 +61,11 @@ class RestApi {
59
61
install(ContentNegotiation ) {
60
62
json(json)
61
63
}
64
+ install(HttpTimeout ) {
65
+ val timeout = TimeUnit .MINUTES .toMillis(2 )
66
+ connectTimeoutMillis = timeout
67
+ requestTimeoutMillis = timeout
68
+ }
62
69
}
63
70
64
71
private val nasaApi: NasaApi = NasaApi (ktor)
You can’t perform that action at this time.
0 commit comments