Skip to content

Customizable timeout for pkg_search/advanced_search #124

Description

@gladkia

Overview

HI @gaborcsardi. Thanks for creating such a great package. I have a suggestion for a small improvement.

The R_PKG_SEARCH_SERVER can occasionally be unavailable link.

The curl::curl_fetch_memory has a long timeout set by default (10[s]).

> curl::curl_fetch_memory(test_url)
Error in curl::curl_fetch_memory(test_url) : 
  Timeout was reached: [gladki.pl:4321] Connection timeout after 10001 ms

Fortunately, the timeout setting can be easily changed

> new_handle <- curl::new_handle(url = test_url)
> curl::handle_setopt(
+   new_handle,
+   .list = list(timeout = 2)
+ )
> curl::curl_fetch_memory(test_url, handle = new_handle)
Error in curl::curl_fetch_memory(test_url, handle = new_handle) : 
  Timeout was reached: [gladki.pl:4321] Connection timed out after 2002 milliseconds

Proposed solution

Add the possibility to change the timeout for the curl's connect phase. With such a change, if R_PKG_SEARCH_SERVER becomes unavailable, one can spot the error faster than within 10[s].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions