Git Product home page Git Product logo

humbundee's People

Contributors

amiramix avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

laymer zabrane

humbundee's Issues

Duplicate files may be skiped if they are part of the same json

Application remembers downloaded files so that any new file with the same md5/sha1 as one of the already downloaded files should be skipped. However, when adding new files with the same md5/sha1 to the download queue and if that md5/sha1 isn't yet in the database, the duplicate files will be only detected if they are all are added to the download queue at the same time. A race condition is possible where duplicate files are not detected:

  1. Two or more files are in the same json but their md5/sha1 is not yet in the database
  2. The first file is added to the download queue and downloaded
  3. The second file is added to the download queue after the first one has been completed - the duplicate file is also downloaded

This should be rare if at all possible since files from the same json are added to the download queue roughly at the same time, as soon as their torrents have been downloaded. However, the downloading of torrents is asynchronous and hence a race condition is possible. The longer is the download queue the smaller is the chance that a duplicate file is downloaded before the other duplicate is added to the download queue.

A bigger issue is with only indexing the json rather than downloading it because then nothing is being added to the download queue. However even in this case the issue is only visible in logs because in any case only one file with the duplicated md5/sha1 will be stored in the database (the other duplicates are overwritten).

This could be fixed by checking any new download not only against the list of already downloaded files in the db but also against files currently being downloaded, e.g. every new download could be stored in ETS and then moved to Mnesia once the download has finished.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.