-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update-with-start: shopping cart #156
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want this to be an activity invocation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
a538c41
to
588f4f1
Compare
Co-authored-by: Chad Retz <[email protected]>
d9316ff
to
4c070fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing blocking
except WorkflowUpdateFailedError: | ||
price = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, done.
@@ -0,0 +1 @@ | |||
TASK_QUEUE = "uws" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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