Why `DownloadRequest`'s `serializingDownloadedFileURL()` doesn't have `automaticallyCancelling` paramerter?

Looking at the source code, it seems that Alamofire chose not to expose the underlying automaticallyCancelling for serializingDownload(using:automaticallyCancelling:).

I know that I can extend DownloadRequest and make a serializingDownloadedFileURL(automaticallyCancelling:), but I'm wondering if there is a reason related to Swift Concurrency that I'm missing?

That was just an oversight. I've put up the bug/missing-automatic-cancel branch with the fix. I should be able to release it soon.

2 Likes

@Jon_Shier Thanks for the quick reply.

Just curious, why the default is false for cancelling automatically? is it safer or recommended?

It's really to follow the principle of least surprise, as there are several areas where concurrency constructs can implicitly cancel where the user may not expect their request to be cancelled at the same time. So it's better to opt into the behavior rather than have to opt out.

1 Like

A fix for this has been released in 5.6.1.

Thanks. (I think the CHANGELOG links to the wrong PR for this fix)