UNPKG

yekonga-server

Version:
28 lines (22 loc) 816 B
// @ts-nocheck /*global Yekonga, serverLibrary */ if(!Yekonga.pdfQueue) { Yekonga.pdfQueue = {}; } if(!Yekonga.pdfProcessing) { Yekonga.pdfProcessing = {}; } setInterval(()=>{ var keys = Object.keys(Yekonga.pdfQueue); var processKeys = Object.keys(Yekonga.pdfProcessing); var pdfInstances = Yekonga.Config.pdfInstances? Yekonga.Config.pdfInstances: 6; // console.debug("-----", processKeys); if(processKeys.length < pdfInstances && keys.length) { const key = keys[0]; const { html, filepath, options } = Yekonga.pdfQueue[key]; Yekonga.pdfProcessing[key] = { html, filepath, options }; delete Yekonga.pdfQueue[key]; // console.debug(processKeys); Yekonga.Helper.PDF_PROCESS(html, filepath, options, key); } }, 1000)