Apify and Crawlee Official Forum

Updated 5 months ago

working with requestQueue/ catching apify Errors when using Apify API Client for Javascript

At a glance
Hey everyone. I'm trying to run multiple actor calls simultaneously, and that works fine, unless I go over the allotted memory (32GB). I would like to use a requestQueue, which I assume would run calls in order whenever there is available memory? But I have a hard time understanding how to add actors to the queue with the API.
e.g. client.requestQueue("...").addRequest() accepts some unclear parameters that don't seem to contain an actor or the data to pass to the actor. This very much might be because I'm a javascript noob that has a bit of a hard time understanding the documentation XD

If I completely misunderstood the idea of a requestQueue, I would like to create my own. For that, I would like to be able to try/catch a normal client.actor(...).call() but specify the error, except I can't seem to find a way to specify the specific error you would get when requesting the use of too much memory (e.g. some error object to import from apify and use).

sorry for the noob questions XD
P
l
2 comments
Hi ,
RequestQueue is just a storage that hold the Requests. You need to use a Crawler like BasicCrawler and to actually evaluate the items from EequestQueue.

Simple situation could be that:

You may set the maxConcurrency to the Crawler options. If your runs are each taking 1 GB and you have only 5 GB availaable on your account set the maxCocncurency to 5 GB.

More complex situation would be to try always fill the unused memory space with a new run that uses different amount of RAM than the other runs.
I am afraid that in this case, you would nee to implement the sort of Priorify based Queue on yourself.
Gotcha! thank you . I guess I'll just implement it myself XD
Add a reply
Sign up and join the conversation on Discord