How to get users to do the file in turn



  • There's a PHP file. There's a PHP violin.

    There are different kinds of checks and requests to the database.

    We need to make sure that if the lasers open this file with practical synchronization, they're in line for this violin.

    For there's gonna be a full-time cat.

    Imagine that person has opened this page, and a request for the extraction from the database of accessible records has been made. )

    Next, the scrupt checks out the files that we've learned.

    If they do, there's an opdium asking for the meaning that I'm working on these tapes, and now other users can't retrieve these records.

    Now imagine that almost synchronized two people have turned to the script.

    Everyone has two requests and one check.

    He's getting a request from the first person, he's getting free records, but at that point, he's getting a second-person retrieval, and he's getting the same. The second request comes from the first person, and he's reporting that the ape is busy, and the second one also goes on a second request, and he's also been making a good update.

    It doesn't have to be like this, you need to get the files on people's turns, you know?



  • From the gun on the graves: try to organize priorities

    When applied, the user receives not instantly a response, but in turn, and receives a unique id of his task. And it starts, pump, once a second, to be informed about the state of its task under her id, the client's JS can ajax'om once a second, pump.

    Only one " working " process is performed on a first-come, first-served basis. This process is constantly working in the background, waiting for new assignments.

    Look at this. http://gearman.org/ RabbitMQ.


    In your task, it may be possible to limit itself to the right work with the OBD: http://dev.mysql.com/doc/refman/5.7/en/commit.html if it is possible to determine the appropriateness of the necessary records not in php, but directly in MySQL; or to lock the tables within the time of one php crypt?


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2