Open fonkadelic opened 6 months ago
Thank you so much! I love that you actually did some work here. To be honest, I was mostly parroting some information I got from Swift folks on the forums from here: https://forums.swift.org/t/structured-caching-in-an-actor/65501
It is possible that I'm wrong. It's also possible things have changed. Or maybe there are subtleties we aren't quite accounting for. Perhaps all three!
I'm going to look more closely at this soon, I just wanted to acknowledge the issue and make sure you knew that I appreciated it.
Looking forward to your findings!
What could be really helpful for this project is wrapping some of the code snippets from the recipes in a Swift package and setting up a test suite. This would demonstrate the usage but also chances are high that the tests will reveal if things have changed in an unexpected way.
Ok, so first of all, this rocks.
I'm not entirely sure how to reconcile this result with what the Apple people told me in that forum. But I think it's pretty clear that this does in fact propagate priorities. I suspect there could be some other things going on here that this test may not account for. But, at this point, I think it's warranted that the wording be changed.
I also really love the idea of putting together some tests. At worst, they will help to catch dumb typos and at best they can challenge assumptions just like this.
I'll use this issue to track updating wording. The test suite is a little more work, and I've captured that with #7 .
The recipe about structured concurrency mentions in "Solution #1: Use an unstructured Task":
I've did a bit research on this and i think priority propagation works even with an unstructured task inside an actor.
For my tests i've used this slightly modified version of the code example:
The priority seems to be in sync and gets escalated which brings me to the conclusion that priority propagation works as expected even in this scenario.