Bug Fix journal---------player information is repeatedly written to the database

Source: Internet
Author: User

Structure Introduction:

When the client goes offline, the client sends a message to the server, tells the server that I want to go offline, and then the client executes the offline function.

The Downline function executes a function that allows the server to write the client's data to the database and delete the client from the session list.

The Downline function is also executed when the server accepts the intention of the client to go offline.

This is done to prevent the client from accidentally offline, causing the client to fail to execute the Downline function, the server to write data to the database itself.

Live Diary:

When writing test cases, when the client executes the Downline function, the database is immediately clear. This will cause the server to still write data to the database, but the database

has been emptied, so this will be an error.

Analysis Process:

From the site diary can be very simple analysis of the cause of the error, it is natural to think of the flag that this client has been executed the downline function.

After doing this, the problem really solved. A second problem was found shortly thereafter. Because the program is multithreaded, it happens to write data to the database.

The operation to clear the database will be performed before execution, so the error will still occur. Then think of writing another downline service, let the data go to the database first to write, and then

Perform a downline operation. and then block the service off. This service is executed to perform other services.

Final Solution:

After the analysis of the solution is very simple, first mark the client has successfully executed the Downline function.

Then write a downline service that blocks the service.

Bug Fix journal---------player information is repeatedly written to the database

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.