Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7840339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:44:55+00:00 2026-06-02T15:44:55+00:00

We are developing an IOS game and are using google-app-engine for backend. The users

  • 0

We are developing an IOS game and are using google-app-engine for backend. The users can cash in in-game money by tapping buildings. The users tap several buildings fairly fast and this causes several concurrent transactions on the same object (USER) and on different buildings.

Unfortunately this means that the 4-5th tap times-out since it looses retries. It also means that 2nd to 5th tap is very slow due to the lock.

My first thought was to make the transaction into a task, but then totalAmount will be wrong on the second call to the function, since the first call is not completed yet.

So any good ways to support multiple fast updates to the same entity?

       int retries = 5;
        while (retries > 0) {

            // Wrap everything into a transaction from here
            TransactionOptions options = TransactionOptions.Builder.withXG(true);
            Transaction txn = datastore.beginTransaction(options);

                try{
                    // Ok we got the template - now check against the 

                   // Update user... with money gained 
                   // Update Building...money withdrawn

                   //Do the transaction
                    datastore.put(txn, user.getEntity());
                    datastore.put(txn, building.getEntity());
                    txn.commit();

                    // do callback code...which returns TotalMoney

                    break;

                } catch (Exception e) {
                    if(retries > 0){
                        retries--;
                    }
                    else{
                   //fail code...
                } finally {
                    if (txn.isActive()) {
                        txn.rollback();
                    }
                }
            }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:44:58+00:00Added an answer on June 2, 2026 at 3:44 pm

    For consistency you need transactions, for responsiveness you shoul use backends:

    1. Use backend instance to keep data in memory for fast update.

    2. Whenever data is updated in backend also start a task and transactionally update entity in Datastore.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing iOS app using phonegap. Users first have to register or log
I'm developing an iOS app. Its working properly on simulator. I'm using phonegap and
I am developing an iOS app that allows users to download documents off a
I have been developing a simple game for iOS which involves dragging and using
I'm developing a game on iOS w/ cocos2d+box2d as the game engine, and am
I'm developing a cross platform game engine this targets Windows, Linux, Mac, Mobiles(Android, iOS)
I am developing an iOS app using iOS 4.2 SDK, but I want the
I am developing iOS game and need custom animation so I am using this
I am developing a game using Cocos2D for iOS. There are some scenes like
I'm developing an app for iOS. This is a game. In the game screen

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.