-
Notifications
You must be signed in to change notification settings - Fork 14
@w 18338461 Bug fix #646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue 8000 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
@w 18338461 Bug fix #646
Conversation
|
||
@Test | ||
void testPollRetriesOnChannelBeingClosed() throws Exception { | ||
SftpDirectorySource source = new SftpDirectorySource(); |
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.
This seems common in all tests - maybe we should extract it out in before test?
@@ -116,7 +115,7 @@ public class SftpClient { | |||
private String cwd = "/"; | |||
private static final Object LOCK = new Object(); | |||
private String home; | |||
private long heartBeatInterval = 30000; | |||
private long heartBeatInterval = 10000; // 10 seconds heartbeat interval |
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.
why did we reduce this interval?
synchronized (LOCK) { | ||
disconnect(); | ||
// Reinitialize client | ||
if (nonNull(proxyConfig)) { |
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.
There is a similar code block on line 141 - if needed should we extract this in a separate method?
if (nonNull(proxyConfig)) { | ||
client = ClientBuilder.builder() | ||
.factory(MuleSftpClient::new) | ||
.randomFactory(PRNGAlgorithm.AUTOSELECT.getRandomFactory()) |
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.
Also in the code block on line 141, the random factory is set in a different way - are both the codes doing the same thing?
// Reconnect and authenticate | ||
login(username); | ||
// Retry the original operation | ||
return new SftpFileAttributes(uri, sftp.stat(path)); |
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.
should we instead call getFileAttributes method her which also handles exceptions?
extractConnectionException(e).ifPresent(pollContext::onConnectionException); | ||
if (isChannelBeingClosed(e)) { | ||
try { | ||
fileSystem = cleanUpAndReconnectFilesystem(pollContext, fileSystem); |
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.
this is also repeated since line 199, should this be extracted too?
SonarQube Quality Gate |
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
Hi, thank you for your work. We understand that you want to merge your changes and move on from this issue, but we also want to maintain the safety, readability, and testability of our code. Because of this, we kindly ask that you confirm that you have fulfilled the prerequisites for each category of activity before merging your changes.
If the Pull Request has a dependency update:
For ALL the Releases:
NOTE: (applies only for Core-Connectors connectors and modules) The release process ends when you merge the pull request that updates the support branch to the new snapshot, please don't forget to do this.
Patch Version:
Minor Version:
Major Version: