-
Notifications
You must be signed in to change notification settings - Fork 42
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
fix: duration json type parsing fix #412
fix: duration json type parsing fix #412
Conversation
Zigmas Satkevičius seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
760c327
to
9ef9e62
Compare
Any ideas when this could be merged? 🥺 |
Could you add a test case? |
I cannot offer you tests, as they're functional and integrated within our system, but this snippet is basically already a test, just needs an assertion. Without the code updated this will throw InvalidArgumentException $type = new \Temporal\Internal\Marshaller\Type\DurationJsonType(new class implements \Temporal\Internal\Marshaller\MarshallerInterface
{
public function marshal(object $from): mixed
{
return null;
}
public function unmarshal(array $from, object $to): object
{
return new \stdClass();
}
});
$type->parse($type->serialize(1), null); |
9ef9e62
to
ddba232
Compare
ddba232
to
1545a3b
Compare
Got a few free minutes, added a test :) without the fix it fails |
Do you need the ability to unmarshal ActivityOptions from the old JSON structure? |
You saying where are more changes? I think only intervals changed Here's the JSON payload exmple from 2.7.* {
"TaskQueueName": "test_queue",
"ScheduleToCloseTimeout": 0,
"ScheduleToStartTimeout": 0,
"StartToCloseTimeout": 5000000000,
"HeartbeatTimeout": 0,
"WaitForCancellation": false,
"ActivityID": "",
"RetryPolicy": {
"initial_interval": 0,
"backoff_coefficient": 1,
"maximum_interval": 0,
"maximum_attempts": 4,
"non_retryable_error_types": []
}
} Here is 2.8 {
"TaskQueueName": "test_queue",
"ScheduleToCloseTimeout": 0,
"ScheduleToStartTimeout": 0,
"StartToCloseTimeout": 5000000000,
"HeartbeatTimeout": 0,
"WaitForCancellation": false,
"ActivityID": "",
"RetryPolicy": {
"initial_interval": {
"seconds": 0,
"nanos": 0
},
"backoff_coefficient": 1,
"maximum_interval": {
"seconds": 0,
"nanos": 0
},
"maximum_attempts": 4,
"non_retryable_error_types": []
}
} |
It should be nanoseconds, right?
|
…als are int nanoseconds
b652f13
to
005c126
Compare
Yes the old format is in nanoseconds |
It's indeed an unusual case that DTOs of internal configurations are stored in the database or transferred between services. |
What was changed
Added ability to parse DurationJsonType instance.
Why?
It no longer works, and if you need to pass it around to other services or save ActivityOptions somewhere, stuff breaks. I've made this as a check, so it should be BC, and messages using older format shouldn't fail during deployment.