The current checkContextForCallout() method looks like this:
private void checkContextForCallout() {
if (Limits.getLimitCallouts() < 1) {
throw new BoxApiRequestException('BoxApiRequest unable to make a callout due to no remaining callouts allowed (Limits.getLimitCallouts() == 0).');
}
}
However, getLimitCallouts() returns the per transaction callout limit -- so, 100 is always returned.
If the intent is to make sure that the number of callouts made so far hasn't hit the limit, then the method should probably be:
private void checkContextForCallout() {
if (Limits.getLimitCallouts() <= Limits.getCallouts()) {
throw new BoxApiRequestException('BoxApiRequest unable to make a callout due to no remaining callouts allowed.');
}
}
The current checkContextForCallout() method looks like this:
However, getLimitCallouts() returns the per transaction callout limit -- so, 100 is always returned. If the intent is to make sure that the number of callouts made so far hasn't hit the limit, then the method should probably be: