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 7646641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:15:38+00:00 2026-05-31T10:15:38+00:00

I have a design problem, my app has a grows up traffic and I

  • 0

I have a design problem, my app has a grows up traffic and I have a lot a “Transaction collision. Retrying…”. I don’t know how avoiding them.

Introduction:
Each Actor in this app can visit an another Actor.

That is my actual design (it can have errors, it just an example):

class Actor(object):
  name = db.StringProperty()

class ActorVisits(object):
  """Store a list of all actors has visited the parent of this kind

  Note: Has an ancestor an Actor
  """
  visits = db.ListProperty(db.Key)

class Visit(object):
  """A new visit by actor on the parent of this kind.
  Each time a same actor visits the parent of this kind, this kind is updated
  with the new datetime for the visit.

  Note: Has an ancestor an Actor
  """
  actor = db.ReferenceProperty(collection_name=Actor)
  visited_at = db.datetimeProperty()

That is an example of use case:

foo = Actor(name="foo")  
bar = Actor(name="bar")

db.put([foo, bar])

def trx():
  """Store a new visite from 'bar' to 'foo' """

  av = ActorVisits.get_bey_keys_name(key_name="v/foo", parent=foo)
  if av is None:
    av = ActorVisits(key_name="v/foo", parent=foo)

  v = Visit.get_bey_keys_name(key_name="v/foo/bar", parent=foo, actor=bar)
  if v is None:
    v = Visit(key_name="v/foo/bar", parent=foo, actor=bar)
  v.visited_at = datetime.datetime.utcnow()
  async = db.put_async(v)

  if not v.key() in av.visits:
    av.visits.append(v.key())
    av.put()

  async.get_result()

db.run_in_transaction(trx, bar, foo)

If anybody has an idea for me to make this model better. Thanks

  • 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-05-31T10:15:40+00:00Added an answer on May 31, 2026 at 10:15 am

    Make the Visits eventually consistent, by moving them out of the Actor’s EntityGroup. If each Visit is a root entity, you wont run into any write rate issues, and you can query for them easily.

    If you don’t want to create lots of Visit Entities, but just update a single one, you can make the key of the Visit deterministic, by basing it off the Actor, and the visitor.

    So Actor has Id of 123,
    Vistor(another Actor) has Id of 888,

    You make a key of type Visit, with Id of “123_888” (no parent) , You put() the Visit with this key, and updated time, and it overwrites previous Visit. You can also do a get() on the key, and it will be strongly consistent (if you are keeping a count say).

    You can then build ActorVisits with an eventually consistent query.

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

Sidebar

Related Questions

Please assist with MVVM design/understanding problem. Given that we have a Windows Phone app
I have some sort of a design problem with my Django AJAX application. I
I am trying to design an mail system. I have stuttered on the problem
Suppose I have a design like this: Object GUI has two objects: object aManager
To be more specific, I have an app that has multiple tableViews that drill
I have a design issue that I would appreciate some input on. I would
I have started design of a ColdFusion application that is entirely web based. Not
I have to design a data structure that is to be used in a
I have this design which I cannot seem to get right, I would like
I have to design a form with an input inside it. I use background

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.