Use forValidRefs in field synchronizer

This commit is contained in:
DBotThePony 2022-12-06 18:35:24 +07:00
parent 82389a5e72
commit 5efe3a2e35
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -369,17 +369,7 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa
nextEndpointsCleanup = secondTime + 60
synchronized(endpoints) {
val iterator = endpoints.listIterator()
for (value in iterator) {
val endpoint = value.get()
if (endpoint == null) {
iterator.remove()
} else {
execute.invoke(endpoint)
}
}
endpoints.forValidRefs { execute.invoke(it) }
if (endpoints.size < endpointsMaxCapacity / 2) {
endpoints.trimToSize()