-
Notifications
You must be signed in to change notification settings - Fork 34
Conversation
| public IpAddrAlloc allocateIpAddr(IpAddrRequest request) throws Exception { | ||
| IpAddrAlloc ipAddrAlloc = allocateIpAddrMethod(request); |
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.
@DavidLiu506 Do we still need this function if we push all the process code into allocateIpAddrMethod?
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 called by other functions.
| while(true) { | ||
| try { | ||
| IpAddrRequest result = restTemplate.postForObject(ipManagerUrl, request, IpAddrRequest.class); | ||
| verifyAllocatedIpAddr(result); | ||
| return result; | ||
| } catch (Exception e) { | ||
| // handle exception | ||
| if (++count == maxTries) throw e; | ||
| } | ||
| } |
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.
@DavidLiu506 Should we use formal way to do the retry? such as RetryTemplate described in this link: https://www.baeldung.com/spring-retry
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. Thank you!
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.
@cj-chung fixed using spring framework.
cj-chung
left a comment
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
|
@DavidLiu506 Please add a brief description on the PR as well. |
This is for ip manager performance improvement.
1 Transaction on ipAddrRangeCache (not include vpcIpRangeCache.get(vpcId)), this can reduce distribute lock and improve concurrent cache operation.
2 Add retry logic code in port manager is for cocurrent operate on create subnet and allocate ip.