remove gc period
This commit is contained in:
1 file changed
-12
@@ -17,10 +17,6 @@ import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.selects.select
|
||||
|
||||
class ClashCore(private val service: Service) : CoroutineScope by MainScope() {
|
||||
companion object {
|
||||
private const val CALL_GC_PERIOD = 300
|
||||
}
|
||||
|
||||
private var stopReason: String? = null
|
||||
private val settings = ServiceSettings(service)
|
||||
private val database = ClashDatabase.getInstance(service)
|
||||
@@ -72,7 +68,6 @@ class ClashCore(private val service: Service) : CoroutineScope by MainScope() {
|
||||
|
||||
launch {
|
||||
val ticker = Channel<Unit>()
|
||||
var refreshCount = 0
|
||||
var enableRefresh = settings.get(ServiceSettings.NOTIFICATION_REFRESH)
|
||||
&& service.getSystemService<PowerManager>()!!.isInteractive
|
||||
|
||||
@@ -97,13 +92,6 @@ class ClashCore(private val service: Service) : CoroutineScope by MainScope() {
|
||||
if (enableRefresh) {
|
||||
ticker.onReceive {
|
||||
notification.update()
|
||||
|
||||
refreshCount++
|
||||
|
||||
if (refreshCount > CALL_GC_PERIOD) {
|
||||
refreshCount = 0
|
||||
System.gc()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user