Skip to contents

In test mode (options(politecollect.test_mode = TRUE)), a session stops after politecollect.max_requests requests (10 by default), with an error of class politecollect_request_cap, so that a script under test cannot run a whole collection. The cap can also be set outside the test mode.

  • request_count() returns the requests sent so far;

  • reset_request_count() sets the counter back to zero.

Usage

request_count()

reset_request_count()

Value

request_count(): an integer. reset_request_count(): NULL, invisibly.

Details

Requests served from the cache are not counted. Requests that a project sends in parallel with httr2::req_perform_parallel() do not go through polite_request() and are not counted either.

See also

Examples

request_count()
#> [1] 0
withr::with_options(
  list(politecollect.test_mode = TRUE, politecollect.max_requests = 2),
  getOption("politecollect.max_requests")
)
#> [1] 2