Skip to content
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

Pivotal ID #186675047: FTP connection pool #792

Merged
merged 4 commits into from
Dec 15, 2023

Conversation

Juan-EBI
Copy link
Contributor

Copy link
Contributor

@jhoanmanuelms jhoanmanuelms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Really nice improvement!

Please consider my comments before merging


/**
* Pooled FTP client. Allows to re use FTPClient instances so socket connections and ftp logging does not need to be
* perform on each FTP operation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: ... does not need to be performed on each ...

return try {
ftpClient.sendNoOp()
} catch (e: Exception) {
logger.error(e) { "Error checking ftp connection" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should log the exception message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger.error(e) will garantee is logged

): GenericObjectPool<FTPClient> {
val factory = FTPClientFactory(ftpUser, ftpPassword, ftpUrl, ftpPort)
var connections = GenericObjectPool(factory)
connections.minIdle = 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this throw magic number warning?

}

/**
* As Ftp clients are re used we need to garantee that if working directory is changed it is restored after
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edit suggestion: ... to guarantee that, if the working directory is changed, it is restored after the operation is completed.

private val testInstance = FtpClient.create(FTP_USER, FTP_PASSWORD, ftpServer.getUrl(), ftpServer.ftpPort)

@Test
fun `upload a file, list and download it`() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest: upload a file, list it and download it because for a moment I thought the comma was not intentional and it was referring to a file list

@Juan-EBI Juan-EBI merged commit 2724872 into master Dec 15, 2023
1 check passed
@Juan-EBI Juan-EBI deleted the feature/pivotal-186675047 branch January 11, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants