Feature or a Bug? Two scripts using database simultaneously



  • Hi,
    Hope someone knows the answer.
    I have a database with accounts info (login, pass, proxy etc).

    I've setup a script so that as soon as an account is randomly selected, it's moved from Group "Available" to Group "Recently Used". This happens at the start of a script.

    Now if I set this script to run several times, everything works as expected. So the script only chooses accounts from the "Available" group.

    However, if I open another instance of BAS and run the same script at the same time, it still seems to be able to select accounts that have been moved into "Recently Used".

    This suggests to me the database is not updated in real time between scripts and when both scripts are activated, Script B is not accounting for database changes from Script A and vice versa.

    Is the database intentionally set up this way and is there a way around it? Thanks



  • @Insight said in Feature or a Bug? Two scripts using database simultaneously:

    Hi,
    Hope someone knows the answer.
    I have a database with accounts info (login, pass, proxy etc).

    I've setup a script so that as soon as an account is randomly selected, it's moved from Group "Available" to Group "Recently Used". This happens at the start of a script.

    Now if I set this script to run several times, everything works as expected. So the script only chooses accounts from the "Available" group.

    However, if I open another instance of BAS and run the same script at the same time, it still seems to be able to select accounts that have been moved into "Recently Used".

    This suggests to me the database is not updated in real time between scripts and when both scripts are activated, Script B is not accounting for database changes from Script A and vice versa.

    Is the database intentionally set up this way and is there a way around it? Thanks

    https://wiki.bablosoft.com/doku.php?id=tutorial3



  • @Fox Hey, not sure if you read my question, but I have no issues creating databases or manging a database.

    The issue is with two scripts using a single database simultaneously and if script one makes a change (such as moving an account from Group A to Group B), this change doesn't take place in real-time for the second script running if they're both using the database at the same time. Does this make sense?



  • Hey Insight,
    That topic called Transactions and Concurrency is a Database topic, not BAS.
    And that happens because your database accepts write & read the record at the same time.
    You must configure your database to read-only after all modifications on the record.
    It's an advanced Database topic. You can read about it.

    Just Google it.
    You need the ISOLATION level called SERIALIZABLE Isolation Level
    All the best



  • @Omini said in Feature or a Bug? Two scripts using database simultaneously:

    Transactions and Concurrency

    Great thanks, will do a bit more reading. I'm not sure what advanced DB settings BAS even has for this kind of thing. TBH I will probably just create a work around and start using a schedule to run with 1 thread regularly until a condition is met. Then the DB is updated in real time and massively minimises the odds of a single row being selected by two scripts. Bit of a pain, but I can't see any options in BAS so far to implement what you're discussing! Best Regards


Log in to reply