Skip to content
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

IWF-158: Updating iwf-idl submodule; pinning openapi generator #80

Merged
merged 16 commits into from
Oct 3, 2024

Conversation

stevo89519
Copy link
Contributor

No description provided.

@longquanzheng

This comment was marked as resolved.

@longquanzheng

This comment was marked as resolved.

CommandId: t.CommandId,
FiringUnixTimestampSeconds: t.TimerCommand.FiringUnixTimestampSeconds,
CommandId: &commandId,
DurationSeconds: t.TimerCommand.FiringUnixTimestampSeconds,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is different. see indeedeng/iwf-java-sdk#229 and cc @samuel27m who also has the context

Copy link
Contributor Author

@stevo89519 stevo89519 Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@longquanzheng I added the change to replace FiringUnixTimestampSeconds with DurationSeconds in this MR since it was dependent on the iwf-idl update. Tests all pass now.

@@ -52,12 +50,12 @@ func NewInternalChannelCommand(commandId, channelName string) Command {
}
}

func NewTimerCommand(commandId string, firingTime time.Time) Command {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar in Java using Duration, The standard way in Golang is using time.Duration.

Also this is a breaking change here, not a huge problem to me. But we should make it clear in release -- (that's why I thought haivng a sparate PR makes it easier, but it's okay)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it may be better to keep compabitility for this api. And create a NewTimerCommandByDuration API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would the TimerCommand.DurationSeconds be populated using this firingTime time.Time param?
int64(firingTime.Sub(time.Now()).Seconds())? And then adding a check if negative, set to 0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes 👍 that’s the idea (same in Java SDK, we used to convert duration to timestamp)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should panic if setting a negative timestamp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could lead to false panics though right? E.g.
firingTime = now + 500ms
... blah ... (this ends up taking 600ms)
NewTimer(firingTime) { now -100ms }

Copy link
Contributor

@longquanzheng longquanzheng Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, good catch.
Probably mark this method as "deprecated" now, in favor of NewTimerCommandByDuration -- It's more useful in practice and people should migrate to it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reasons that I want to panic is that when this happened in the past, it's usally user workflow code issues, but it's a bit hard to figure out why (they used a static/constant for the timerCommand, whcih got the converted value forever during after deployed).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you described is possible, but It should be extremely rare that someone want to sleep for milliseconds. The temporal timer is not accurate at millisecond either. But it's possible that a state api call can take a few seconds, but that's also pretty rare.

I am okay to remove the panic, you can decide it.

@stevo89519 stevo89519 merged commit 988f6dc into main Oct 3, 2024
3 checks passed
@stevo89519 stevo89519 deleted the jira/sharrison/IWF-158.2 branch October 3, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants