box-salesforce-sdk icon indicating copy to clipboard operation
box-salesforce-sdk copied to clipboard

BoxApiRequest.checkContextForCallout() method does nothing

Open Feldhacker opened this issue 5 years ago • 0 comments

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.');
   }
}

Feldhacker avatar May 16 '19 13:05 Feldhacker