oTree Forum >

How Does Livepage Deal with "Simultaneous" Messages

#1 by OSubK (edited )

Dear Chris and all,

Hi, I am considering a setting where an object is given to the players in a first-come-first-serve manner. Each player can claim an object by pressing a button and a player will get a good if he presses the button first. I am trying to implement this using livepage, doing something like:

def live_method(player, claim):
    if group.good_available:
        player.claimed = True
        group.good_available = False

I wonder how the server deals with the messages if they come almost simultaneously. I worry that if the timing at which two players press the button is close enough, both will get the object.

Thank you

#2 by Chris_oTree

The server is single threaded so there won’t be race conditions.

Write a reply

Set forum username