Aller au contenu

Missing Cancellation Check (ARCH9024)

Ce contenu n’est pas encore disponible dans votre langue.

Key swift.async.missing-cancellation-check · Severity warning · Category async

Flags long loops in async functions that never check Task.isCancelled / Task.checkCancellation() - cancellation cannot stop them.

for item in items { await process(item) }
for item in items { try Task.checkCancellation(); await process(item) }

Check Task.isCancelled or call Task.checkCancellation() inside the loop.