-
Notifications
You must be signed in to change notification settings - Fork 94
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
Add idempotency key to flows.create_flow #116
Conversation
Naive first implementation
Also add coverage for versions to first test
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.
A few very superficial comments
Co-authored-by: Chris White <[email protected]>
And fix accidental override of flow local in that case
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.
Could you add one final test? I want to ensure we always update the idempotency key so that the following situation works as expected:
flow.register("Blah", idempotency_key="foo")
# v1flow.register("Blah")
# v2flow.register("Blah", idempotency_key="foo")
<-- should actually register a new version instead of using v2
So a test that creates a flow w/ key, creates a flow without, then creates a final flow with the original key should register a new version.
Including X -> Y -> X and X -> None -> X
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.
LGTM
pytest.param(("foo", None, "foo"), id="same key with empty between"), | ||
pytest.param(("foo", "bar", "foo"), id="same key with different between"), | ||
], | ||
) |
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.
nice, well done
Summary
Adds optional idempotency keys to the
create_flow
API, the most recent key for a flow group is stored in thesettings
dict and is referenced when creating a flow to prevent sequential flow creation with the same key.Importance
Future work
This only works for sequential flow creation and we may want support in the future to prevent re-registrations for old flow versions. However, this would involve adding a column to the Flow table and additional complexity. We also don't really have support for old versions right now so it isn't quite necessary.
Checklist
This PR:
changes/
directory (if appropriate)