-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
FTP Connection Management Optimization using Singleton Pattern #213
FTP Connection Management Optimization using Singleton Pattern #213
Conversation
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.
@felipeadeildo thank you for your PR. I've ran some simple tests locally and notice that the Databases are not loading their Directories' __content__
. I've included some comments pointing what's missing in the load_directory_content
method to make it to work.
simple testcase:
from pysus.ftp import Directory
Directory("/dissemin/publicos/CIHA/201101_/Dados").load().__content__ # should not be []
Oh, i agree! |
I've fixed the problem with the last commits. I would appreciate your revision, @luabida |
Hello @felipeadeildo, could you please rebase your PR based on the latest release? I've fixed the CI and added some endpoint tests that will ensure the ftp functionality. Also, please note that you should be using semantic release commit message format in the PR title to include your changes in the next release |
* fix(CI): fix CI workflows * run pre-commit * include pre-commit before testing * include pre-commit before commiting * linting pt.1 * linting pt.2 * replace mocked tests by endpoint tests * remove compose-go * linting pt.3 final
I approved approved the tests on CI, but I think the rebase has failed, since there should have only the files you eddited in the PR. Please check the rebase with the command |
* fix(CI): fix CI workflows * run pre-commit * include pre-commit before testing * include pre-commit before commiting * linting pt.1 * linting pt.2 * replace mocked tests by endpoint tests * remove compose-go * linting pt.3 final
9a99f65
to
05178c4
Compare
Hey! I'm waiting the ftp server turns on again. When the service comes back, I will execute the tests ( So, i will mark this PR as "still in progress" for a while. |
Hi! I've run the tests, and all FTP-related tests passed successfully. However, there are some warnings regarding deprecated functions in the
|
@felipeadeildo you may run the command |
Ok, done. |
🎉 This PR is included in version 0.15.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Overview
This PR implements an FTP connection singleton pattern to significantly improve module import performance. The change was motivated by discussion #211 where multiple redundant FTP connections were identified as a performance bottleneck.
Changes
FTPSingleton
class to manage a single FTP connectionDirectory
class to use the singleton patternPerformance Impact
The implementation shows dramatic performance improvements:
Before (main branch):
After (with FTP singleton):
Performance Test Code
I believe this change significantly improves the library's performance while maintaining its ease of use and reliability.
Note: I've added some type-hints that was lacking, a lot of warnings was appearing (some of them was solved putting a type ignore alias.)