DocMerge occasionally fails and returns a 4KB PDF that is actually a text file that only contains the word "BUSY"

Hello,

I have a custom scheduler that loops through Opportunities and generates a PDF based on the Opportunity.  The code I am using came from this thread:
How to call DocMerge from a Hook ?

I setup a 5 minute delay between calls in order to not overwhelm the system and it still results in a few bad PDFs. The bad PDFs are a 4KB .pdf file that is actually a text file that only contains the word "BUSY".

Out of 650 calls, roughly 5 are bad.  If I run the same set of records, a different set of documents will fail to generate and the ones that failed previously will work.  I can also generate PDFs manually via the UI on the records that error.  This makes me believe that it is not an issue with the data on the records as the data is not changing.

I used https://www.autohotkey.com/ to create thousands of PDF Documents for one record and it never errored.  My code is simple and pasted below.

Has anyone else ever experienced this either via custom code, Process Definition, or the UI?

$docMerge = new DocumentMergeApi();
$api = new \RestService();
$docmergeData = [
    'mergeType' => 'convert',
    'templateId' => $docTemplate,
    'templateName' => $filename, //20231215-JEK-This cannot be left blank, it errors, but I can pass any text I want here for use in the filename.
    'useRevision' => false,
    'recordId' => $opportunitychild->id,
    'recordModule' => 'Opportunities',
    'flowData' => '',
];
//$GLOBALS['log']->fatal(print_r($docmergeData, true));
$mergeId = $docMerge->merge($api, $docmergeData);

Thank you,
Justin  Kuehlthau

Parents Reply Children
No Data