Skip to content

Commit

Permalink
Reduce the unnecessary network reconnect (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixhuang authored Oct 24, 2024
1 parent 718eebf commit c926adc
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ class AsyncAbacusStateManagerV2(

private var environments: IList<V4Environment> = iListOf()
set(value) {
field = value
ioImplementations.threading?.async(ThreadingType.abacus) {
if (field != value) {
field = value
_environment = findEnvironment(environmentId)
ioImplementations.threading?.async(ThreadingType.main) {
stateNotification?.environmentsChanged()
Expand All @@ -117,8 +117,11 @@ class AsyncAbacusStateManagerV2(
private var _environment: V4Environment? = null
set(value) {
if (field !== value) {
val shouldReconnect = field?.id != value?.id
field = value
reconnect()
if (shouldReconnect) {
reconnect()
}
}
}

Expand Down

0 comments on commit c926adc

Please sign in to comment.