Multiple threads grab the same resource

  • I have a .txt file with the lines login : password

    I run the script, it parses the txt file(Parse CSV string) and enters the site using the login and password.

    The problem is that if the script was launched, for example, in 4 threads, then in the case when there is one line of login:password has left (in the .txt), several threads will "grab" it at the same time.

    As a result, I have several threads working with the same resource in parallel.

    How can this be prevented?

    I need that when one thread grabs one line from a txt file, then the other threads no longer touch this line.

  • When creating new resource set it to "LinesFromFile".
    Than choose "Only read", and finally "Use each line one time".

    That way every thread will use each line only once, wheather its
    "Success" or "Fail" status.

    You can further fine tune these resource settings by double clicking
    on resource name in "Data tab". It will bring new window named
    "Edit resource". There you can make some further settings - for example
    you can set ""Max fail usage" to "2" or "3" or some large number instead
    of default "1", which will result with using failed lines multiple times until
    it is done with success.

  • @GaG i set "Max number of simultaneous use" to 1. It really helps me. Thx!

Log in to reply