Conversation
5ee2dbb to
4f8940e
Compare
message_passing/update_with_start/lazy_initialization/README.md
Outdated
Show resolved
Hide resolved
message_passing/update_with_start/lazy_initialization/workflows.py
Outdated
Show resolved
Hide resolved
|
|
||
| @workflow.update | ||
| async def add_item(self, item: ShoppingCartItem) -> str: | ||
| price = await get_price(item) |
There was a problem hiding this comment.
I think you want this to be an activity invocation
There was a problem hiding this comment.
Thanks! So (a) too much Typescript, and (b) this is a good example of a mistake that an AI linter could catch but traditional analysis wouldn't.
a538c41 to
588f4f1
Compare
Co-authored-by: Chad Retz <chad@temporal.io>
d9316ff to
4c070fd
Compare
| except WorkflowUpdateFailedError: | ||
| price = None |
There was a problem hiding this comment.
May want a bit more of a conditional to confirm it's the failure you expect instead of swallowing every update failure ever. In .NET I checked the application failure's error type: https://github.com/temporalio/samples-dotnet/blob/86a49887aaa668beb3cadb4fa862574f3295fcc6/src/UpdateWithStartLazyInit/Program.cs#L85-L90
There was a problem hiding this comment.
Good call, done.
| @@ -0,0 +1 @@ | |||
| TASK_QUEUE = "uws" | |||
There was a problem hiding this comment.
I think the task queue should be named specific to the sample so it doesn't clash with others (also, this constant isn't used in starter.py as might be expected)
The Workflow represents a Shopping Cart in an e-commerce application, and
update-with-start is used to add items to the cart, receiving back the updated cart subtotal.
Cannot be merged until UwS is released