File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 5757# dpi used for images in TESSERACT and other stuff
5858OCR_IMAGE_DPI = int (os .environ .get ("OCR_SERVICE_IMAGE_DPI" , 200 ))
5959
60-
6160# LIBRE OFFICE SECTION
6261
6362# 60 seconds before terminating processes
6968# a libre office server will only use 1 CPU by default (not changable), thus,
7069# for handling multiple requests, we will have one service per OCR_WEB_SERVICE_THREAD
7170DEFAULT_LIBRE_OFFICE_SERVER_PORT = 9900
72- LIBRE_OFFICE_LISTENER_PORT_RANGE = range (DEFAULT_LIBRE_OFFICE_SERVER_PORT , DEFAULT_LIBRE_OFFICE_SERVER_PORT + OCR_WEB_SERVICE_THREADS + OCR_WEB_SERVICE_WORKERS )
7371
72+ LIBRE_OFFICE_PORT_CAP = DEFAULT_LIBRE_OFFICE_SERVER_PORT + 1
73+
74+ if OCR_WEB_SERVICE_THREADS > 1 :
75+ LIBRE_OFFICE_PORT_CAP += OCR_WEB_SERVICE_THREADS
76+ if OCR_WEB_SERVICE_WORKERS > 1 :
77+ LIBRE_OFFICE_PORT_CAP += OCR_WEB_SERVICE_WORKERS
78+
79+ LIBRE_OFFICE_LISTENER_PORT_RANGE = range (DEFAULT_LIBRE_OFFICE_SERVER_PORT , LIBRE_OFFICE_PORT_CAP )
7480LIBRE_OFFICE_NETWORK_INTERFACE = "localhost"
7581
7682
Original file line number Diff line number Diff line change @@ -48,17 +48,17 @@ def start_office_converter_servers():
4848
4949 port_count = 0
5050 for port_num in LIBRE_OFFICE_LISTENER_PORT_RANGE :
51- if OCR_WEB_SERVICE_WORKERS <= 1 :
52- if port_count < OCR_WEB_SERVICE_THREADS :
53- port_count += 1
51+ if OCR_WEB_SERVICE_WORKERS > 1 :
52+ if port_count < 1 :
5453 if port_num not in list (loffice_processes .keys ()):
54+ port_count += 1
5555 if is_port_in_use (port_num ) == False :
5656 loffice_processes [port_num ] = start_office_server (port_num )
5757 else :
5858 break
5959 else :
6060 print ("WOREKER TRYING PORT " + str (port_num ))
61- if is_port_in_use (port_num ) == False and port_count < OCR_WEB_SERVICE_WORKERS :
61+ if is_port_in_use (port_num ) == False and port_count < OCR_WEB_SERVICE_THREADS :
6262 loffice_processes [port_num ] = start_office_server (port_num )
6363 port_count += 1
6464 else :
You can’t perform that action at this time.
0 commit comments