tagatac / bagoup

Mac OS Messages export
GNU Affero General Public License v3.0
72 stars 4 forks source link

Increase the open file limit before writing PDFs #64

Closed tagatac closed 2 months ago

tagatac commented 2 months ago

What is changing: Check the OS-level open file limit (and adjust it if necessary) prior to writing PDF files.

Why this change is being made: There is the potential for wkhtmltopdf to need many open files (see https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3081). This was fixed in #14, where it depended on the order of events:

  1. Stage the PDF file, getting the number of images
  2. Check and adjust the open file limit
  3. Flush the PDF file to disk

Number 3 was achieved via the call defer outFile.Close(): https://github.com/tagatac/bagoup/blob/86f9b32870d2127f3fd3e196cecfc24265cf8d87/write.go#L29

However, #29 removed Close() from the OutFile interface, collapsing Stage() and Flush() into a single function Flush() run prior to checking and adjusting the open file limit.

Related issue(s): Fixes #63

Follow-up changes needed: None AFAIK

Is the change completely covered by unit tests? If not, why not?: Yes