I have a node under Firebase for different restaurants which contains a list of active and past visitors. This node is named listvisitors
. Under the restaurant node, i want a counter for all the visitors. Here is where I want to use Firebase transactions.
The idea is to increment the counter when a person opens the restaurant page. As there would be contention, transaction seems like a good option.
A popular restaurant can have loads of visitors simultaneously visiting thus leading to contention. Can transactions scale to handle this?
If so, what is the maximum retries that transaction can handle before failing with the max retries error. (Essentially the max simultaneous updates assuming all users log in at the same time)
If not. Is there an efficient alternative to essentially count the number of current children under lists and get the correct number?