ankur2037
11/24/2023, 5:23 PMCoroutineScope
in each class instance (Wrapper class also created for each request), as shown in the following code snippet:
class Wrapper {
private var coroutineScope: CoroutineScope? = null
fun getResponse(block: (response) -> Unit) {
if (coroutineScope?.isActive != true) {
coroutineScope = CoroutineScope(Dispatchers.Main + SupervisorJob())
}
coroutineScope?.launch {
dataFlow.collect { response ->
block(response)
}
}
}
}
After making this change, I am frequently encountering Nginx 403 errors, specifically timeouts. Has anyone else experienced a similar issue or have insights into what might be causing these errors?CLOVIS
11/27/2023, 10:37 AMsuspend
keyword).
I'm not sure what the problem is exactly in this case, but I wouldn't be surprised if the entire Wrapper
instance got GC'd.