-
Notifications
You must be signed in to change notification settings - Fork 272
Introduce SDK flag to use user DC on Memo's #2121
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
base: master
Are you sure you want to change the base?
Changes from all commits
463a971
f3dc42e
bd9b603
4483a59
a0cf54d
049d0fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,13 +29,20 @@ const ( | |
| // SDKFlagBlockedSelectorSignalReceive will cause a signal to not be lost | ||
| // when the Default path is blocked. | ||
| SDKFlagBlockedSelectorSignalReceive = 5 | ||
| SDKFlagUnknown = math.MaxUint32 | ||
| // SDKFlagMemoUserDCEncode will use the user data converter when encoding a memo. If user data converter fails, | ||
| // we will fallback onto the default data converter. If the default DC fails, the user DC error will be returned. | ||
| SDKFlagMemoUserDCEncode = 6 | ||
| SDKFlagUnknown = math.MaxUint32 | ||
| ) | ||
|
|
||
| // unblockSelectorSignal exists to allow us to configure the default behavior of | ||
| // SDKFlagBlockedSelectorSignalReceive. This is primarily useful with tests. | ||
| var unblockSelectorSignal = os.Getenv("UNBLOCK_SIGNAL_SELECTOR") != "" | ||
|
|
||
| // memoUserDCEncode exists to allow us to configure the default behavior of | ||
| // SDKFlagMemoUserDCEncode. This is primarily useful with tests. | ||
| var memoUserDCEncode = os.Getenv("MEMO_USER_DC_ENCODE") != "" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment says this is useful for tests, but I don't see this used in the SDK anywhere. Why did we need to add this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's set and used in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as well as configuring the default behavior for tests, so we can validate both the old and new behavior |
||
|
|
||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| func sdkFlagFromUint(value uint32) sdkFlag { | ||
| switch value { | ||
| case uint32(SDKFlagUnset): | ||
|
|
@@ -50,6 +57,8 @@ func sdkFlagFromUint(value uint32) sdkFlag { | |
| return SDKPriorityUpdateHandling | ||
| case uint32(SDKFlagBlockedSelectorSignalReceive): | ||
| return SDKFlagBlockedSelectorSignalReceive | ||
| case uint32(SDKFlagMemoUserDCEncode): | ||
| return SDKFlagMemoUserDCEncode | ||
| default: | ||
| return SDKFlagUnknown | ||
| } | ||
|
|
@@ -130,3 +139,7 @@ func (sf *sdkFlags) gatherNewSDKFlags() []sdkFlag { | |
| func SetUnblockSelectorSignal(unblockSignal bool) { | ||
| unblockSelectorSignal = unblockSignal | ||
| } | ||
|
|
||
| func SetMemoUserDCEncode(userEncode bool) { | ||
| memoUserDCEncode = userEncode | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
Just for my confirmation (didn't review whole PR or anything), this flag will now be set for any workflow that uses
UpsertMemoorExecuteChildWorkflowbut not for any other workflows? But for now this is off by default unless theMEMO_USER_DC_ENCODEenv var is set? And I presume one day we'll just turn it on for all users (i.e. changevar memoUserDCEncode = os.Getenv("MEMO_USER_DC_ENCODE") != ""toos.Getenv("MEMO_USER_DC_ENCODE") != "false"or something)?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.
What do you mean "not for any other workflows"? My understanding is this should be set for all workflows, regardless of if they use
UpsertMemoorExecuteChildWorkflow.Correct, one day we will flip the switch to turn it on by default. iirc server needs a version or 2 to fall back onto, so we want to wait a bit before flipping the switch on a new SDK flag
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.
When I looked at when
.TryUse(SDKFlagMemoUserDCEncode)was invoked, it was only in those two situations, but I may be misreadingThere 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.
ahh no I think you're right, but does it matter if we set the SDK flag if our workflow isn't exercising Memo code? I wanna say no. The flag is primarily for replaying and ensuring this fix doesn't cause NDE with pre-fix histories
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.
It doesn't matter, in fact I think it's better to not have the flag for everyone, just confirming that is the case.