Hie,

when assign stock move, try_assign lock table (1). In Backend
PostgresSQL, the lock is NOWAIT (2).

When two or more users try to assign shipments at same time, "second
user" get a nice error.

Traceback is:

  File "/shipment.py", line 1292, in assign_try
    for m in s.inventory_moves]):
  File "/move.py", line 754, in assign_try
    Transaction().cursor.lock(cls._table)
  File "/trytond/backend/postgresql/database.py", line 359, in lock
    self.cursor.execute('LOCK "%s" IN EXCLUSIVE MODE NOWAIT' % table)
OperationalError: could not obtain lock on relation "stock_move"

Why lock() method in PSQL backend add NOWAIT option? Why not waiting
next user request when unluck table and continue try_assin? the
reason?

About NOWAIT: If NOWAIT is specified, LOCK TABLE does not wait to
acquire the desired lock

note:
is a scenario related to [tryton] Large Scale Deployments, A
Discussion (3) when have multiples users working at same time with
trytond balancer = a lot user writing stock.move table.

thanks

(1) http://hg.tryton.org/modules/stock/file/d29329efc4b8/move.py#l753
(2) 
http://hg.tryton.org/trytond/file/71c72b11ec81/trytond/backend/postgresql/database.py#l370
(3) https://groups.google.com/d/msg/tryton/O996ux1C_EQ/Rwd6cvI-8N4J

Reply via email to