Browse Source

Add a FOR UPDATE NOWAIT at the beginning of the transaction.

pull/22/head
Alexis de Lattre 11 years ago
committed by Lorenzo Battistini
parent
commit
338655b41b
  1. 2
      base_location_geonames_import/wizard/geonames_import.py

2
base_location_geonames_import/wizard/geonames_import.py

@ -93,6 +93,8 @@ class better_zip_geonames_import(orm.TransientModel):
bzip_ids_to_delete = bzip_obj.search( bzip_ids_to_delete = bzip_obj.search(
cr, uid, [('country_id', '=', country_id)], context=context) cr, uid, [('country_id', '=', country_id)], context=context)
if bzip_ids_to_delete: if bzip_ids_to_delete:
cr.execute('SELECT id FROM res_better_zip WHERE id in %s '
'FOR UPDATE NOWAIT', (tuple(bzip_ids_to_delete), ))
bzip_obj.unlink(cr, uid, bzip_ids_to_delete, context=context) bzip_obj.unlink(cr, uid, bzip_ids_to_delete, context=context)
logger.info( logger.info(
'%d better zip entries deleted for country %s' '%d better zip entries deleted for country %s'

Loading…
Cancel
Save