Skip to content

Commit 97f1f48

Browse files
authored
Switch to ureq for our simple sync HTTP get request (#1167)
Turns out that you aren't allowed to call `reqwest::blocking::get()` from inside `tokio::block_on()` reqwest uses tokio internally, which means that `reqwest::blocking::get()` tries to use tokio blocking APIs, but when you're already inside a tokio runtime (which we are due to our top level `tokio::block_on()`) you can't use any additional tokio blocking APIs. It results in a full panic and a confusing message. You can supposedly do stuff like this to push the blocking work onto an actual blocking thread used by tokio ``` let resp = tokio::task::spawn_blocking(|| { cache::get("dplyr") }).await.unwrap(); ``` but thats so awkward to think about, especially considering that we want the cache to be "warm" most of the time, not requiring tokio at all. --- Instead, I think we should switch to ureq, which is one of the other popular but more minimal HTTP clients and is _always blocking_, which is fine for us right now. This still requires the tweaks to the Windows github action. ureq uses ring under the hood (at least for now, see algesten/ureq#1141). On ARM Windows where we have an MSVC target of `aarch64-pc-windows-msvc`, ureq needs to compile in a lot of C code with clang, but ends up finding the Rtools MinGW tooling that is put on the PATH, and that causes it to fail with an `<assert.h>` missing header error.
1 parent fdebe2e commit 97f1f48

7 files changed

Lines changed: 135 additions & 390 deletions

File tree

.github/workflows/test-windows.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@ jobs:
3939
r-version: ${{ matrix.config.r }}
4040
use-public-rspm: true
4141
# Putting Rtools related tooling on the PATH causes Rust crate
42-
# compilation to pick up Rtools's `link.exe` and mingw32 related
43-
# tooling, in particular it can cause aws-lc-sys compilation to fail
44-
# on ARM Windows, where it uses clang-cl and has to compile in a bunch
45-
# of C code.
46-
# https://github.com/aws/aws-lc-rs/blob/main/book/src/requirements/windows.md
42+
# compilation to pick up Rtools's MinGW tooling, in particular it can
43+
# cause ring (used by ureq) compilation to fail on ARM Windows, where
44+
# it uses clang and has to compile in a bunch of C code.
45+
# https://github.com/briansmith/ring/blob/main/BUILDING.md
4746
windows-path-include-rtools: false
4847

4948
- name: Install R Packages Required For Tests

0 commit comments

Comments
 (0)