ropensci / rdefra

rdefra: Interact with the UK AIR Pollution Database from DEFRA
https://docs.ropensci.org/rdefra
16 stars 6 forks source link

SiteID = NA causes hanging errors #6

Closed sebsfox closed 5 years ago

sebsfox commented 7 years ago

Hi - the package is great. Thanks for making it available.

I get errors with most functions when I include sites where SiteID = NA, eg:

library(rdefra)
stations_raw <- ukair_catalogue()
stations <- ukair_get_coordinates(stations_raw)

Gives the following error: Error in curl::curlfetchmemory(url, handle = handle) : Failure when receiving data from the peer

Though the following works instantly:

library(rdefra)
stations_raw <- ukair_catalogue()
stations <- ukair_get_coordinates(stations_raw[!is.na(stations_raw$EMEP.Site.ID),])

Thanks

cvitolo commented 5 years ago

The problem seems to be with the number of requests sent to the server, not with NAs. Your second example (that works) you are sending less than 1000 requests. In your first example you are sending more than 1000 requests, which causes the server to fail.

I have temporarily disabled http2, as explained here.

Now your first example works, although NAs might be generated by coercion.

I'm closing this as the issue is resolved. Thanks for reporting it!