Comments (6)
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.
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.
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.
@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.
@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.
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)
- Do you meet the heap size limit ?
- Can we protect the zip with password? HOT 2
- Apex CPU time limit exceeded HOT 9
- Are the files (with classes) supposed to be saved as .cls or .apxc? I know it is a noob question, but better to not waste time if I am off base. HOT 1
- System.StringException: Starting position out of bounds: 201590400 HOT 7
- Copying files from one zip to another.
- This creates a zip file, but not a compressed zip file ... HOT 1
- Is there a Deflate implementation in the lib?
- Apex CPU time limit exceeded HOT 1
- Not a valid UTF-8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zippex.