Countdown n A child to modify the order status, how this logic is implemented?

Source: Internet
Author: User
is a scheduled program executed at the server setup?
Or when you visit this page to find out more than the time and then modify?

Reply content:

is a scheduled program executed at the server setup?
Or when you visit this page to find out more than the time and then modify?

I don't think it's necessary to update in real-time, like this kind of problem I think the better way is to record an expiration time when the order is created, then when the order is read, just judge the time stamp to verify whether the expiration and the current state can continue to operate the purpose, Timing tasks and so on is not a good strategy, first of all, you use PHP to interact with the system level of efficiency, but the risk of the intermediate program is not very controllable, in addition to large order volume of the server load is also very high

According to your logic or the timing of the script, otherwise every time you visit the time to change is not real-time not to say, inefficient.

You can use a Linux system to schedule tasks so that you don't have to loop

If you do not use the browser side of the WebSocket, there is access to deal with whether or not to expire;
If the use of websocket, it is still honest cron run up ~
See the specific business scenario requirements

Are you talking about a function that is similar to canceling an order without payment for 15 minutes? I haven't done it, so I can only say a few thoughts. When an order is generated, PHP calls the system function operation to create a task that executes after 15 minutes, and the task statement is dynamically generated, such as Php-f Checkorderstatus.php-id 323003
Checkorderstatus.php inside also use the system function to delete this scheduled task (if there is a one-time scheduled task do not bother, I actually do not understand Linux, when used to search information) on the line.
As for the @accyl to mention the load problem is not too worried, because this feature does not go through the Web service, so the execution of the file must be much smaller than the cost of creating an order, the order can deal with this is even more no problem.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.