mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
if child is already resolved/rejected — no need to notify it
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -78,6 +78,10 @@ open class AsyncPromise<T> : Promise<T>, Getter<T> {
|
||||
override fun notify(child: AsyncPromise<in T>) {
|
||||
LOG.assertTrue(child !== this)
|
||||
|
||||
if (child.state != State.PENDING) {
|
||||
return
|
||||
}
|
||||
|
||||
when (state) {
|
||||
State.PENDING -> {
|
||||
addHandlers(Consumer({ child.catchError { child.setResult(it) } }), Consumer({ child.setError(it) }))
|
||||
|
||||
Reference in New Issue
Block a user