From 5616cc3274ef3594758aa199a7338c3cd197d836 Mon Sep 17 00:00:00 2001 From: Vegard Stikbakke Date: Fri, 5 Apr 2024 06:35:21 +0200 Subject: [PATCH] Don't do the conversion in a goroutine --- cmd/lambda/main.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/lambda/main.go b/cmd/lambda/main.go index 8a2350d..0c4465d 100644 --- a/cmd/lambda/main.go +++ b/cmd/lambda/main.go @@ -159,9 +159,10 @@ func getTable(file *extract.File) ([][]string, error) { return nil, fmt.Errorf("failed to convert to boxes: %w", err) } rows, table := box.ToTable(boxes) + log.Printf("ocr-to-table: %s", time.Since(startAlgorithm).String()) // Create images with words and cells - go func() { + func() { if file.ContentType == extract.PNG { imageWithWords, err := image.AddBoxes(file.Bytes, boxes) if err != nil { @@ -182,10 +183,6 @@ func getTable(file *extract.File) ([][]string, error) { } }() - log.Printf("ocr-to-table: %s", time.Since(startAlgorithm).String()) - if err != nil { - return nil, fmt.Errorf("failed to convert to table: %w", err) - } tableBytes, err = json.MarshalIndent(table, "", " ") if err != nil { return nil, fmt.Errorf("failed to convert table to json: %w", err)