diff --git a/main.py b/main.py
index 0a1c5b958be051fed080714798447f25de9c5e12..03cad9c152fe63e7a099a33b3a919b8cc1e81506 100644
--- a/main.py
+++ b/main.py
@@ -233,12 +233,12 @@ def get_metadata_records_processor(the_rabbit,
 
         the_uuid = record['geonet:info']['uuid']
 
-        # if is_locked(the_cfg['session']['working_directory'], the_uuid ):
-        #     logging.info("Dataset with uuid = %s is already being indexed: skipping." % the_uuid)
-        #     continue
-        # else:
-        #     logging.info("Setting lock for dataset with uuid = %s" % the_uuid)
-        #     lock(the_cfg['session']['working_directory'], the_uuid)
+        if is_locked(the_cfg['session']['working_directory'], the_uuid ):
+            logging.info("Dataset with uuid = %s is already being indexed: skipping." % the_uuid)
+            continue
+        else:
+            logging.info("Setting lock for dataset with uuid = %s" % the_uuid)
+            lock(the_cfg['session']['working_directory'], the_uuid)
 
         # delete_dataset_from_indices(cfg, record['geonet:info']['uuid'])
         delete_dataset_from_dest_index(the_rabbit=the_rabbit,