-
Notifications
You must be signed in to change notification settings - Fork 755
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
Add socket read timeout implementation #15261
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15261 +/- ##
============================================
+ Coverage 23.24% 23.36% +0.12%
- Complexity 5065 5071 +6
============================================
Files 1342 1341 -1
Lines 67464 67600 +136
Branches 9192 9200 +8
============================================
+ Hits 15680 15798 +118
- Misses 50046 50064 +18
Partials 1738 1738
Continue to review full report at Codecov.
|
stdlib/socket/src/main/java/org/ballerinalang/stdlib/socket/tcp/ReadPendingSocketMap.java
Outdated
Show resolved
Hide resolved
socketChannel.write(buf); | ||
} | ||
Thread.sleep(2000L); | ||
timeoutLeecher.waitForText(22000); |
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.
Instead of having a thread sleep can't we only use the leecher timeout?
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.
The read will timeout after 20 seconds in here. Added thread.sleep add some grace period to prevent intermittent test failures when the server get busy due to some other factors.
*/ | ||
public static long getReadTimeout() { | ||
long timeout = DEFAULT_READ_TIMEOUT_VALUE; | ||
if (ConfigRegistry.getInstance().contains(CONFIG_READ_TIMEOUT)) { |
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.
IMO reading config value as a runtime param should have the highest priority. WDYT?
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.
Normally closest config to the code should take the precedent. Also, this value affects globally.
log:printInfo("Client close: " + caller.remotePort); | ||
} | ||
} else { | ||
io:println(result.detail().message); |
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.
Shall we use log for this as well?
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.
LogLeecher matches exact words. When we used log it print timestamp as well.
Purpose
Approach
Samples
Remarks
Check List