getMaxScriptsOnStack
int session.getMaxScriptsOnStack ( )
Description
Get the total number of scripts allowed on the stack before the scraping session is forcibly stopped.
Parameters
This method does not receive any parameters.
Return Values
Returns max number of scripts that can be running at a time, as an integer.
Change Log
| Version | Description |
|---|---|
| 5.0 | Added for all editions. |
Examples
Check If More Scripts Can Be Run
// Get Number of Scripts (running and max)
numRunningScripts = session.getNumScriptsOnStack();
maxAllowedScripts = session.getMaxScriptsOnStack();
// Calculate percentage used
float percentageUsed = numRunningScripts / maxAllowedScripts;
if (percentageUsed < 0.90)
{
session.log(percentageUsed.toString() + "% of max scripts used");
}
else
{
session.logWarn("90% max scripts threshold has been reached.");
}
numRunningScripts = session.getNumScriptsOnStack();
maxAllowedScripts = session.getMaxScriptsOnStack();
// Calculate percentage used
float percentageUsed = numRunningScripts / maxAllowedScripts;
if (percentageUsed < 0.90)
{
session.log(percentageUsed.toString() + "% of max scripts used");
}
else
{
session.logWarn("90% max scripts threshold has been reached.");
}
scraper on 07/16/2010 at 5:19 pm
- Printer-friendly version
- Login or register to post comments
