From 338655b41beb30ca40e29d1e16c39d4513a31ac1 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 11 Apr 2014 23:30:57 +0200 Subject: [PATCH] Add a FOR UPDATE NOWAIT at the beginning of the transaction. --- base_location_geonames_import/wizard/geonames_import.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/base_location_geonames_import/wizard/geonames_import.py b/base_location_geonames_import/wizard/geonames_import.py index 2d9db3ccf..e5f9daab2 100644 --- a/base_location_geonames_import/wizard/geonames_import.py +++ b/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( cr, uid, [('country_id', '=', country_id)], context=context) 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) logger.info( '%d better zip entries deleted for country %s'