For me, the proposal of locking all the tables at the beginning of the transaction has two problems:
So the only way I can think we can solve the issue is by locking before the transaction has been started, probably by using lock_id() in another transaction within the same RPC call.
It could be defined something like this:
cls.__rpc__['method'].locks = lambda ids: ids
If the dispatcher, found that locks is not empty it creates a transaction and inside it calls "lock_id(id)" for each of the ids returned by the method (calling it with all the IDs of the RPC request).
If all succeeded, then the usual transaction is called for the 'method'.
At the very end, the transaction with the locks is rolled back (or committed).
|2022-10-04 15:26:42||albertca||set||messageid: <1664890002.0344498.JJXQ5QQOBYIRJZ3G.email@example.com>|
|2022-10-04 15:26:42||albertca||set||recipients: + ced, yangoon, acaubet|
|2022-10-04 15:26:41||albertca||link||issue10870 messages|
Showing 10 items. Show all history (warning: this could be VERY long)