add delay GCAP
Showing
1 changed file
with
9 additions
and
0 deletions
| 1 | import json | 1 | import json | 
| 2 | import time | ||
| 2 | import logging | 3 | import logging | 
| 3 | import traceback | 4 | import traceback | 
| 5 | from datetime import datetime, timedelta | ||
| 4 | from collections import OrderedDict | 6 | from collections import OrderedDict | 
| 5 | from . import app | 7 | from . import app | 
| 6 | from apps.doc.models import AFCOCRResult, HILOCRResult, AFCComparisonInfo, HILComparisonInfo | 8 | from apps.doc.models import AFCOCRResult, HILOCRResult, AFCComparisonInfo, HILComparisonInfo | 
| ... | @@ -157,6 +159,13 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id): | ... | @@ -157,6 +159,13 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id): | 
| 157 | '[compare_res={5}]'.format(log_base, application_entity, application_id, uniq_seq, | 159 | '[compare_res={5}]'.format(log_base, application_entity, application_id, uniq_seq, | 
| 158 | ocr_res_id, comparison_res)) | 160 | ocr_res_id, comparison_res)) | 
| 159 | 161 | ||
| 162 | # 时间延迟 | ||
| 163 | send_time = last_obj.create_time + timedelta(seconds=15) | ||
| 164 | while datetime.now() < send_time: | ||
| 165 | compare_log.info('{0} [time wait 5s] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}]'.format( | ||
| 166 | log_base, application_entity, application_id, uniq_seq, ocr_res_id)) | ||
| 167 | time.sleep(5) | ||
| 168 | |||
| 160 | # 将比对结果发送GCAP | 169 | # 将比对结果发送GCAP | 
| 161 | try: | 170 | try: | 
| 162 | data = gcap.dict_to_xml(comparison_res) | 171 | data = gcap.dict_to_xml(comparison_res) | ... | ... | 
- 
Please register or sign in to post a comment