Giter VIP home page Giter VIP logo

Comments (6)

dineshkumar1603 avatar dineshkumar1603 commented on July 19, 2024 1

We made the execution asynchronous and now we were able to unzipAttachement zip file successfully for file having less than 300kb per file inside Zip File, more than 300kb leads to CPU limit. @future(limits='3xCPU').
We are in need of processing file which is nearly 1Mb file inside Zip file. Please do provide us workaround for resolving CPU Time limit.

from zippex.

Savier9 avatar Savier9 commented on July 19, 2024

Hi there. Same issue. I it caused when getFile(filename) is called.

If the zip has like 20Kb, it will pass through, though really slow. 100kb (not so much I gues) zip just wont pass with CPU limit reached error.

34kb zip barely made it. 55Kb wont. Files inside the zip are just small images.

from zippex.

qdriscoll avatar qdriscoll commented on July 19, 2024

Hello, I'm running up against the max string length of 6000000 when generating .zip file. Is it possible to get around this issue? Thanks!

from zippex.

pdalcol avatar pdalcol commented on July 19, 2024

@qdriscoll, I think you see that error because you are hitting the Apex heap size limit but there might be a higher limit on strings regardless of heap size. I recommend you clear large variables after you are done using them. For example after you add a file to a Zip archive you can set that variable to null.

Zippex sampleZip = new Zippex();
Blob fileData = Blob.valueOf('Sample text.');
sampleZip.addFile('sampleFolder/test.txt', fileData, null);
fileData = null; //REDUCE HEAP SIZE
Blob zipData = sampleZip.getZipArchive();

If that is not enough, you can also run your code asynchronously which will double the available heap size. And for even larger heap size you can use @future(limits='3xHeap').

from zippex.

pdalcol avatar pdalcol commented on July 19, 2024

@Savier9 it is extremely CPU intensive to inflate compressed Zip files. We are trying to add a few new optimizations to be able to handle larger files. @xoob has some ideas here: #20 that we will be implementing soon.

In the meantime use asynchronous mode like queueable, batch or future to get a larger CPU limit. In future mode you can also use @future(limits='3xCPU') to get even larger limits. The simplest way to use asynchronous mode is by calling Zippex.unzipAttachment() and passing true in the fourth parameter.

from zippex.

TheAmigo avatar TheAmigo commented on July 19, 2024

For creating Zip files, one solution would be to allow setting the compression mode to "store". Such archives would be larger, but creating them will use far less CPU time. Ideally, this would be an optional 4th argument to addFile(). If missing, it would behave as it does now, but specifying "store" would add that file to the archive without trying to compress it.

One practical application is when creating .xlsx files. I'd gladly save some CPU time to create a larger file.

from zippex.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.