You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AI says: "The AsyncRepeatingChannel is returned before the Task completes. This could lead to race conditions if the caller starts using the channel immediately. Consider awaiting the task group completion before returning the channel."
Related to this:
publictypealiasAsyncRepeatingChannel<T:Sendable>=AsyncChannel<(iteration:Int, result:T)>@discardableResult@inlinablepublicfunc repeating<T:Sendable>(
count:Int,
_ function:@escaping(Int)async->T)async->AsyncRepeatingChannel<T>{letchannel=AsyncRepeatingChannel<T>()Task{awaitwithTaskGroup(of:Void.self){ group in
for i in 0..<count {
group.addTask{await channel.send((i,function(i)))}}}
channel.finish()}return channel
}
on the 2nd of August, 2024.
I'm leaning in, but wanna give it a second thought and a bunch of tests before I accept it.
This funciton is in use for more than a year in prod by many projects and individuals, and so far it didn't explode. I'm not saying that this is proof by any means, just a reason why I defer this topic.
The text was updated successfully, but these errors were encountered:
"The @autoclosure attribute is used with an async function, which might lead to unexpected behavior. Consider removing @autoclosure or documenting its intended use."
AI says: "The AsyncRepeatingChannel is returned before the Task completes. This could lead to race conditions if the caller starts using the channel immediately. Consider awaiting the task group completion before returning the channel."
Related to this:
on the 2nd of August, 2024.
I'm leaning in, but wanna give it a second thought and a bunch of tests before I accept it.
This funciton is in use for more than a year in prod by many projects and individuals, and so far it didn't explode. I'm not saying that this is proof by any means, just a reason why I defer this topic.
The text was updated successfully, but these errors were encountered: