The decorated function is very short and should run very quickly. Knowing how long the function takes would help. Can you print some timestamps before and after the function is called, so we know what we are talking about?
I see two reasons why you could end up with transaction conflicts here:
-
You are executing this hundreds of times per second.
If this is the case, there is nothing much you can do. You may need to use a faster database. -
You are not executing this on the server, that is you are executing this either on an uplink script or on the client.
If this is the case, then the uplink / client should call a server function so that code is executed in the server and the transaction starts and ends in the server.
Since you are only using one row, perhaps using get instead of search will slightly speed up the job and decrease the chances of transaction conflict.