Skip to content

♻️ refactor(file-manager): improve locking and writing logic for file…#3

Merged
abmmhasan merged 1 commit intomainfrom
feature/code-refactor
Nov 18, 2024
Merged

♻️ refactor(file-manager): improve locking and writing logic for file…#3
abmmhasan merged 1 commit intomainfrom
feature/code-refactor

Conversation

@abmmhasan
Copy link
Copy Markdown
Member

… operations

  • Updated SafeFileReader to ensure locks are released only when files are properly initialized.
  • Enhanced the SafeFileWriter lock mechanism to increase retries from 3 to 5 and delay from 100ms to 200ms for better robustness.
  • Removed redundant try-finally block in the __call method of SafeFileWriter.
  • Changed write methods to return the actual number of bytes written (int|false) instead of boolean, improving API clarity and usability.
  • Added exceptions to the destructor in SafeFileWriter to handle potential resource issues during cleanup.

BREAKING CHANGE: Modified the return type of multiple private write methods in SafeFileWriter from bool to int|false. This impacts integrations relying on previous boolean responses.

… operations

- Updated `SafeFileReader` to ensure locks are released only when files are properly initialized.
- Enhanced the `SafeFileWriter` lock mechanism to increase retries from 3 to 5 and delay from 100ms to 200ms for better robustness.
- Removed redundant try-finally block in the `__call` method of `SafeFileWriter`.
- Changed write methods to return the actual number of bytes written (`int|false`) instead of boolean, improving API clarity and usability.
- Added exceptions to the destructor in `SafeFileWriter` to handle potential resource issues during cleanup.

BREAKING CHANGE: Modified the return type of multiple private write methods in `SafeFileWriter` from `bool` to `int|false`. This impacts integrations relying on previous boolean responses.
@abmmhasan abmmhasan merged commit 325a1e2 into main Nov 18, 2024
@abmmhasan abmmhasan deleted the feature/code-refactor branch April 4, 2026 10:49
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.

1 participant