Post

Replies

Boosts

Views

Activity

Reply to Kitchen service
I do not have an issue with multiple orders, but, with multiple cooks, handling different orders concurrently. The orders are not in an array, but are coming from an AsyncSequence, 1 every second (mimicking a very busy soup restaurant!). That AsyncSequence is the parameter for func handleShift<Orders>(orders: Orders) async throws, which I took outside the Cook object, and placed it inside the Kitchen service. Inside it, looping through each available cook, I set the order, with a group task. So, depending on how I write this, either my cooks are working on the same order (it should be 1 order for 1 cook) concurrently, or, my group task are not concurrent; meaning, the logic waits for the cook to complete its order before moving on to the next order, which will be assigned to the same cook, or, that AsyncSequence will not wait for the orders to be completed, ending too soon, so the code can no longer react on the non-assigned orders. I just need to rethink this a bit, as it is obvious I messed up the creation of these various tasks :) This structured concurrency concept, group task, AsyncSequence, AsyncIterator are totally new to me, just trying to get my head around it, by messing up code :) :) I will eventually solve this, but thanks for your help.
Jul ’23