Skip to content

Commit ee2df40

Browse files
committed
Rework fix for SFG
1 parent 0501084 commit ee2df40

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/util/SingleFlightGroup.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class SingleFlightGroup<T> {
3030
public suspend fun singleFlight(block: suspend () -> T): T {
3131
mu.lock()
3232
val job = inFlight
33-
if (job != null) {
33+
if (job?.isActive == true) {
3434
waitCount++
3535
mu.unlock()
3636

@@ -52,6 +52,6 @@ public class SingleFlightGroup<T> {
5252
inFlight = deferred
5353
mu.unlock()
5454
runCatching { block() }.let { deferred.complete(it) }
55-
return deferred.await().also { inFlight = null }.getOrThrow()
55+
return deferred.await().getOrThrow()
5656
}
5757
}

0 commit comments

Comments
 (0)