MuhammaraJS icon indicating copy to clipboard operation
MuhammaraJS copied to clipboard

Any idea to modify recrypt function as a promise based one? currently It's blocking the event loop!

Open rvigneshw opened this issue 3 years ago • 9 comments

When trying to use recrypt function to encrypt a pdf on server, no other request is getting processed

rvigneshw avatar Jun 29 '21 05:06 rvigneshw

can you try to use this: https://github.com/julianhille/MuhammaraJS/issues/92#issuecomment-871671379

this works with streams but im unsure if this unblocks the event loop

julianhille avatar Jun 30 '21 19:06 julianhille

Tried that, but still, my event loop is blocking :-[

rvigneshw avatar Jul 01 '21 04:07 rvigneshw

I'll have a look at it.

julianhille avatar Aug 05 '21 18:08 julianhille

i digged a bit deeper and the blocking is not from js itself. The cpp code of PDFDocumentCopyingContext and then WriteNewObjects and a foor loop. I don't think this is possible to rewrite as promise without a major rewrite of the underlying cpp code.

Maybe worker threads or multi processing will solve your problem

julianhille avatar Apr 22 '22 17:04 julianhille

Can you give me a small sample snippet to reproduce? An oddly huge pdf i could find myself. 😂

julianhille avatar Jun 22 '22 20:06 julianhille

Update: i've got some idea and will try that.

julianhille avatar Jun 27 '22 09:06 julianhille

Any solution about this? Which recrypt will block the whole nestjs backend

zhuxb711 avatar Oct 26 '22 08:10 zhuxb711

@zhuxb711 do you have any updates on this

xLEpEX avatar Oct 02 '23 12:10 xLEpEX

@xLEpEX Use "Threadz" to run it on another thread

zhuxb711 avatar Oct 02 '23 13:10 zhuxb711