Merge branch 'RED-7669' into 'master'
RED-7669: optimize OCR-module performance Closes RED-7669 See merge request redactmanager/ocr-service!30
This commit is contained in:
commit
8944b57344
@ -96,6 +96,7 @@ public class OcrImageFactory {
|
||||
}
|
||||
|
||||
imageProcessingThread.setAllImagesExtracted(true);
|
||||
imageProcessingThread.interrupt();
|
||||
|
||||
imageProcessingThread.join();
|
||||
|
||||
|
||||
@ -57,13 +57,20 @@ public class ImageProcessingThread extends Thread {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
while (!allImagesExtracted) {
|
||||
final UnprocessedImage image = imageInputQueue.take();
|
||||
var ocrImage = this.process(image);
|
||||
imageOutputQueue.put(ocrImage);
|
||||
try {
|
||||
while (!allImagesExtracted) {
|
||||
final UnprocessedImage image = imageInputQueue.take();
|
||||
var ocrImage = this.process(image);
|
||||
try {
|
||||
imageOutputQueue.put(ocrImage);
|
||||
} catch (InterruptedException e) {
|
||||
imageOutputQueue.put(ocrImage);
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
log.info("All images extracted, emptying processing queue and stopping");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
final UnprocessedImage image = imageInputQueue.remove();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user