Klimatbyran / garbo

1 stars 5 forks source link

Ensure previous job was successful and returned actual data #102

Closed Greenheart closed 2 months ago

Greenheart commented 2 months ago

This PR solves TypeError: Cannot read properties of null (reading 'length') which was triggered in at least one instance at http://localhost:3000/admin/queues/queue/pdf2Markdown/93?status=failed

It seems like completed jobs can still get null as their return value. It might be a symptom of previous jobs not finishing as expected.

Looking at the error from above, the input data looks odd. According to the type definition at https://github.com/Klimatbyran/garbo/blob/543c3bf54e7aeb6500f825fdd131b7063f1daf61/src/workers/pdf2Markdown.ts#L104, existingId should always be a string, but as you can see in the screenshot below, it's undefined.

image

This is what caused the original error.

irony commented 2 months ago

Apart from the question above the PR is approved

irony commented 2 months ago

Jag mergade denna nu efter att ha dubbelkollat att pdfHash inte är en asynkron funktion

Greenheart commented 2 months ago

Ah! Yeah, I found out in the editor and verified with the implementation of pdfHash(), but I should have written that explicitly to make it clear why that was included in the same PR. This could have been an error too :)