From c64999c7cf9cbc3bc51a5d9f58b2a63414db9eff Mon Sep 17 00:00:00 2001 From: Vegard Stikbakke Date: Wed, 14 Aug 2024 22:49:45 +0200 Subject: [PATCH] Don't look up in DynamoDB --- cmd/lambda/main.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/cmd/lambda/main.go b/cmd/lambda/main.go index 2db3bf1..2ddd174 100644 --- a/cmd/lambda/main.go +++ b/cmd/lambda/main.go @@ -128,19 +128,19 @@ func main() { // getTable either cached from DynamoDB if it has been processed before, or perform OCR with Textract func getTable(file *extract.File) ([][]string, error) { - startGet := time.Now() - tableBytes, err := dynamodb.GetTable(file.Checksum) - if err != nil { - return nil, fmt.Errorf("dynamodb.GetTable: %w", err) - } - log.Printf("dynamodb get: %s", time.Since(startGet).String()) - if tableBytes != nil { - var table [][]string - if err := json.Unmarshal(tableBytes, &table); err != nil { - return nil, fmt.Errorf("failed to convert from json: %w", err) - } - return table, nil - } + // startGet := time.Now() + // tableBytes, err := dynamodb.GetTable(file.Checksum) + // if err != nil { + // return nil, fmt.Errorf("dynamodb.GetTable: %w", err) + // } + // log.Printf("dynamodb get: %s", time.Since(startGet).String()) + // if tableBytes != nil { + // var table [][]string + // if err := json.Unmarshal(tableBytes, &table); err != nil { + // return nil, fmt.Errorf("failed to convert from json: %w", err) + // } + // return table, nil + // } // Old: Textract's Analyze Document // output, err := textract.AnalyzeDocument(file) // if err != nil { @@ -183,7 +183,7 @@ func getTable(file *extract.File) ([][]string, error) { } }() - tableBytes, err = json.MarshalIndent(tableStringsSorted, "", " ") + tableBytes, err := json.MarshalIndent(tableStringsSorted, "", " ") if err != nil { return nil, fmt.Errorf("failed to convert table to json: %w", err) }