Skip to content

Question: How to implement retry mechanism when using http urls for Geyser-Plugin-Runner #319

@iondex

Description

@iondex

Hi! We are using the Geyser-Plugin-Runner to download and parse CAR files. Now we want to read from http urls directly as in the open_reader function. However, as the CAR file is very large, the connection may lost. Are there retry mechanisms that can be used to retry or continue from previous lost connections?

pub fn open_reader(path: &str) -> Result<Box<dyn Read + Send>, Box<dyn Error>> {
    if path.starts_with("http://") || path.starts_with("https://") {
        info!("Opening HTTP URL: {}", path);
        let response = reqwest::blocking::get(path)?;
        if !response.status().is_success() {
            return Err(format!("HTTP error: {}", response.status()).into());
        }
        Ok(Box::new(response))
    } else {
        info!("Opening local file: {}", path);
        let file = std::fs::File::open(path)?;
        Ok(Box::new(file))
    }
}

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