Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 4ef0117

Browse files
committed
cancel task onTermination
1 parent 11ef600 commit 4ef0117

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Packages/FeatureServices/SwapService/SwapQuotesProvider.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public struct SwapQuotesProvider: SwapQuotesProvidable {
2424

2525
public func fetchQuotes(wallet: Wallet, input: SwapQuoteInput) -> AsyncStream<Result<SwapperQuote, Error>> {
2626
AsyncStream { continuation in
27-
Task {
27+
let task = Task {
2828
do {
2929
let walletAddress = try wallet.account(for: input.fromAsset.chain).address
3030
let destinationAddress = try wallet.account(for: input.toAsset.chain).address
@@ -35,6 +35,9 @@ public struct SwapQuotesProvider: SwapQuotesProvidable {
3535
}
3636
continuation.finish()
3737
}
38+
continuation.onTermination = { _ in
39+
task.cancel()
40+
}
3841
}
3942
}
4043

0 commit comments

Comments
 (0)