Don't reset discovered servers if list is already empty
Updating discovered servers will trigger a cascade of operations. RecyclerView will launch list-differ, all indicators will be notified, and data-binding will be triggered. If list is already empty, all this work is unnecessary & wasteful.
This commit is contained in:
parent
bfc0607870
commit
e3e4e86305
1 changed files with 1 additions and 1 deletions
|
|
@ -76,7 +76,7 @@ class Discovery(private val context: Context) {
|
|||
}
|
||||
|
||||
isRunning.value = true
|
||||
servers.value = ArrayList() //Forget known servers
|
||||
if (servers.value?.size != 0) servers.value = ArrayList() //Forget known servers
|
||||
|
||||
// Construction of NSD manager is done on a background thread because it appears to be quite heavy.
|
||||
GlobalScope.launch(Dispatchers.Default) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue