f7694cd8 by 周伟奇

fix enqueque

1 parent 79d15292
...@@ -89,7 +89,6 @@ class Command(BaseCommand, LoggerMixin): ...@@ -89,7 +89,6 @@ class Command(BaseCommand, LoggerMixin):
89 base64_data = base64.b64encode(f.read()) 89 base64_data = base64.b64encode(f.read())
90 return {'imgBase64': base64_data.decode('utf-8')} 90 return {'imgBase64': base64_data.decode('utf-8')}
91 91
92
93 async def fetch_ocr_result(self, img_path): 92 async def fetch_ocr_result(self, img_path):
94 async with aiohttp.ClientSession( 93 async with aiohttp.ClientSession(
95 headers=self.ocr_header, connector=aiohttp.TCPConnector(ssl=False) 94 headers=self.ocr_header, connector=aiohttp.TCPConnector(ssl=False)
......
...@@ -186,12 +186,12 @@ class DocView(GenericView, DocHandler): ...@@ -186,12 +186,12 @@ class DocView(GenericView, DocHandler):
186 data_source=random.choice(['POS', 'EAPP', 'Econtract']), 186 data_source=random.choice(['POS', 'EAPP', 'Econtract']),
187 upload_finish_time=timezone.now(), 187 upload_finish_time=timezone.now(),
188 ) 188 )
189 rh.enqueue(doc.id) 189 enqueue_res = rh.enqueue(doc.id)
190 190
191 pdf_file = args.get('pdf_file') 191 pdf_file = args.get('pdf_file')
192 save_dir_path = os.path.join(conf.DATA_DIR, str(doc.id)) 192 save_dir_path = os.path.join(conf.DATA_DIR, str(doc.id))
193 save_file_path = os.path.join(save_dir_path, '{0}.pdf'.format(doc.id)) 193 save_file_path = os.path.join(save_dir_path, '{0}.pdf'.format(doc.id))
194 os.makedirs(save_dir_path, exist_ok=True) 194 os.makedirs(save_dir_path, exist_ok=True)
195 file_write(pdf_file, save_file_path) 195 file_write(pdf_file, save_file_path)
196 self.running_log.info('[mock doc upload success] [doc_id={0}]'.format(doc.id)) 196 self.running_log.info('[mock doc upload success] [doc_id={0}] [enqueue_res={1}]'.format(doc.id, enqueue_res))
197 return response.ok() 197 return response.ok()
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!