mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 09:56:37 -04:00
connection: cleanup errored if more than 5 available
This should reduce the big on disconnect memory leak. Not ideal still, but way better.
This commit is contained in:
parent
2ecfe983ca
commit
aa12de78ac
@ -119,6 +119,7 @@ class PlayConnection(
|
||||
this::error.observe(this) {
|
||||
if (errored || it == null) return@observe
|
||||
ERRORED_CONNECTIONS += this
|
||||
cleanupErrors()
|
||||
state = PlayConnectionStates.ERROR
|
||||
error.report()
|
||||
errored = true
|
||||
@ -274,5 +275,12 @@ class PlayConnection(
|
||||
|
||||
return result.toTypedArray()
|
||||
}
|
||||
|
||||
private fun cleanupErrors() {
|
||||
while (ERRORED_CONNECTIONS.size > 5) {
|
||||
// we just keep 5 connections here, they are for crash reports
|
||||
ERRORED_CONNECTIONS.iterator().remove()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user