Open Lo1nt opened 2 weeks ago
The recent changes focus on enhancing the handling of method timeouts in the SOFA framework. Specifically, a default value is set for the timeout
if it is null
, tests have been added to verify the method timeout configurations, and relevant configurations have been adjusted in the test files to incorporate these timeout settings efficiently.
Files | Change Summary |
---|---|
core/api/src/main/java/com/alipay/sofa/rpc/config/MethodConfig.java |
Modified getTimeout() to return a default value of 0 when timeout is null . |
core/api/src/test/java/com/alipay/sofa/rpc/std/config/AbstractInterfaceConfigTest.java |
Added import for ProviderConfig and included testMethodTimeout method to set and verify method timeout configurations. |
registry/registry-sofa/src/test/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistryHelperTest.java |
Modified to create and manipulate a ProviderConfig object for setting methods with timeouts and added related assertions for verification. |
In code we trust, a rabbit's zest,
Method timeouts put to the test.
No more nulls, just zero’s grace,
Ensuring flows at a steady pace.
With tests and lines, our code expands,
A well-tuned symphony by deft hands. 🚀
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Motivation:
The method-level
timeout
config isInteger
type which acceptsnull
value.So if we add method config and set the method-level
timeout
to null, atimeout=null
might be pub onto registry.Say,
1.1.1.1:12200?rpcVer=12300&serialization=hessian&app_name=demo&[echo]=[clientTimeout#null]
.When dealing with
null
value, some of the implementations may omit catching exception when doingInteger.parseInt(null)
, leading to unexpected startup error.Modification:
As both
null
and0
are meaningless in SOFARPC (might only indicate 'not set', but we do not care), I setmethod.getTimeout
a default 0 return value ifnull
.Result:
Focus on
com.alipay.sofa.rpc.registry.sofa.SofaRegistryHelper#convertProviderToUrls
com.alipay.sofa.rpc.registry.mesh.SofaRegistryHelper#convertProviderToUrls
will not get and pub anull
timeout value any more.Summary by CodeRabbit
New Features
0
for method configurations when no timeout is specified.Tests