5218f898 by 冯轩

initial

1 parent d915554f
...@@ -2037,6 +2037,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -2037,6 +2037,7 @@ class Command(BaseCommand, LoggerMixin):
2037 result_class = AFCOCRResult if is_ca else AFCSEOCRResult 2037 result_class = AFCOCRResult if is_ca else AFCSEOCRResult
2038 res_obj = result_class.objects.select_for_update().filter(application_id=doc.application_id).first() 2038 res_obj = result_class.objects.select_for_update().filter(application_id=doc.application_id).first()
2039 with transaction.atomic(): 2039 with transaction.atomic():
2040 self.online_log.info('{0} [sql lock application_id={1}]'.format(self.log_base, doc.application_id))
2040 if res_obj is None: 2041 if res_obj is None:
2041 res_obj = result_class() 2042 res_obj = result_class()
2042 res_obj.application_id = doc.application_id 2043 res_obj.application_id = doc.application_id
...@@ -2061,6 +2062,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -2061,6 +2062,7 @@ class Command(BaseCommand, LoggerMixin):
2061 last_res_str = json.dumps(old_res_list) 2062 last_res_str = json.dumps(old_res_list)
2062 setattr(res_obj, field, last_res_str) 2063 setattr(res_obj, field, last_res_str)
2063 res_obj.save() 2064 res_obj.save()
2065 self.online_log.info('{0} [sql lock release application_id={1}]'.format(self.log_base, doc.application_id))
2064 except Exception as e: 2066 except Exception as e:
2065 self.online_log.error( 2067 self.online_log.error(
2066 '{0} [process error (ocr result save)] [task={1}] [error={2}]'.format( 2068 '{0} [process error (ocr result save)] [task={1}] [error={2}]'.format(
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!