Return no results if results are evaluated to quickly


Due to the nature of the tarpit prevention mechanism on LfsWorld, if the user doesn't have premium access to the service and one makes two requests within 5 seconds then the service returns no results.
LinqToLfsWorld throws a 'PubstatAccessException' in this case if the results have not been previously cached. This would occur if:
  • The library makes one query (e.g: to get racer statistics)
  • The library then makes a different query within 5 seconds (e.g: to get team information, or racer statistics for a different racer)
    A better solution might be to just return no results if the above happens, which would mean the user wouldn't have to manually program any timing code to prevent this exception from occuring.
Closed Jul 5, 2008 at 8:55 AM by elkdanger
The reason an exception is thrown is because otherwise no distinction could be made between a query which has failed because it was made too quickly after another one, and a query which actually has returned no results.

The way to handle this case is to wrap any code which evaluates LinqToLfsWorld results in a try-catch block and decide what to do with the exception that way.