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

Enhancement: Implement File Locking for Concurrent Writes #234

Open
2 tasks done
asmit27rai opened this issue Jan 14, 2025 · 4 comments · May be fixed by #251 or #283
Open
2 tasks done

Enhancement: Implement File Locking for Concurrent Writes #234

asmit27rai opened this issue Jan 14, 2025 · 4 comments · May be fixed by #251 or #283

Comments

@asmit27rai
Copy link
Contributor

asmit27rai commented Jan 14, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Enhancement: Implement File Locking for Concurrent Writes

Description
Currently, the cache files (folders_cache.txt, images_cache.txt, and videos_cache.txt) do not have any file locking mechanism. If multiple processes or threads attempt to write to the same cache file simultaneously, it could result in data corruption or partial writes.

Problem

  • Multiple concurrent writes can overwrite or corrupt the cache file.
  • No mechanism prevents simultaneous access to cache files.
  • This can lead to inconsistent or lost data.

Proposed Solution
Use the fs2::FileExt crate to implement exclusive file locking while writing to cache files.

Record

  • I agree to follow this project's Code of Conduct
@asmit27rai
Copy link
Contributor Author

@Pranav0-0Aggarwal if this issue looks good pls assign this issue to me....

@anmolgupta2015
Copy link

@asmit27rai I raised a pr for same

@asmit27rai
Copy link
Contributor Author

Hi @anmolgupta2015, I noticed that this issue is currently unassigned. I was planning to work on it and make a PR once it's assigned. You shouldn't ask for assignment first?

@anmolgupta2015
Copy link

Hi @anmolgupta2015, I noticed that this issue is currently unassigned. I was planning to work on it and make a PR once it's assigned. You shouldn't ask for assignment first?

Sorry, I just saw issue and implemented solution for it.
If you have a better solution ..you may raise a PR, I will close mine

@asmit27rai asmit27rai linked a pull request Feb 2, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants