Giter Site home page Giter Site logo

Comments (7)

erickutcher avatar erickutcher commented on August 22, 2024

There's a setting in the Advanced options called "Allow only one instance of the program to run". Is that checked?

As long as it's reading from the same settings file and that setting is checked, then it should only use one instance.

from httpdownloader.

mochahanpen avatar mochahanpen commented on August 22, 2024

Yes, I checked that option.
If a single script calls HTTP_Downloader many times, HTTP_Downloader is called in sequence and not in parallel.
However, if multiple scripts call HTTP_Downloader many times, the instances can be parallel.
If this happens, multiple instances will open the configuration file in parallel, and some instances will fail to load it.

from httpdownloader.

erickutcher avatar erickutcher commented on August 22, 2024

Attach or paste the script to this post so I can see how it's running it.

from httpdownloader.

erickutcher avatar erickutcher commented on August 22, 2024

Here's a beta version you can try out. I reworked the code that handles single instances. Apparently a race condition can occur when using OpenMutex.

HTTP_Downloader_32_1.0.5.1_Beta_2.zip
HTTP_Downloader_64_1.0.5.1_Beta_2.zip

from httpdownloader.

mochahanpen avatar mochahanpen commented on August 22, 2024

My script needs to be called from a custom scheme, which requires editing the registry.
So I modified that script to be simple.
Please place this script in the same folder as HTTP_Downloader.exe.
You can reproduce this by hitting Enter repeatedly to launch the script.
I also tried the Beta version, but unfortunately the problem reproduced itself.

simple_script.zip

from httpdownloader.

erickutcher avatar erickutcher commented on August 22, 2024

The settings file was failing to open because of a sharing violation and so the single instance setting was defaulting to false. The program will now attempt to open the file (at least 5 times) until it's successful.

I'm not sure if your simplified script is similar to your original one, but I'd recommend adding multiple urls to the command line rather than using one at a time. For example: http_downloader.exe --url https://www.example.com/test1.txt --url https://www.example.com/test2.txt

That will cut down on the number of calls to shell.Run() and load things a lot faster.

Similarly, if you have a large list of URLs to add, you can have your script save them to a text file and then use the --url-list argument to load that file rather than including a bunch of --url arguments.

Here's a new version you can test.

HTTP_Downloader_32_1.0.5.1_Beta_3.zip
HTTP_Downloader_64_1.0.5.1_Beta_3.zip

Edit: Beta 4 uses file locks in addition to retrying. It should be sufficient enough to guard against spawning multiple instances.

HTTP_Downloader_32_1.0.5.1_Beta_4.zip
HTTP_Downloader_64_1.0.5.1_Beta_4.zip

from httpdownloader.

mochahanpen avatar mochahanpen commented on August 22, 2024

The beta4 worked fine.
I think the fix of locking the file is perfect.

I didn't know that feature could add multiple URLs.
I thought the multiple calls to shell.Run() were too slow.
It would be very useful to me.

In using custom scheme, the length is limited to 2KB.
So the hint that file can be used to add URLs may be useful in the future, but it may be difficult to use immediately.

Thank you for your response, tips and fixes.

I'm sorry if some of the sentences are not correct.
I'm using a translator.

from httpdownloader.

Related Issues (20)

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.