Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry failed requests per host/origin #50

Open
manpreeeeeet opened this issue Nov 30, 2023 · 3 comments
Open

Retry failed requests per host/origin #50

manpreeeeeet opened this issue Nov 30, 2023 · 3 comments

Comments

@manpreeeeeet
Copy link

pub async fn list_failed_requests(pool: &SqlitePool) -> Result<Vec<QueuedRequest>> {
    tracing::trace!("list_failed_requests");
    let mut conn = pool.acquire().await?;

    // FIXME - we currently tick the retry queue every second, so this effectively gives a
    // rate limit of 5 requests per second. This should probably be configurable on a per-origin
    // basis.
    let query = r#"
    SELECT *
    FROM requests
    WHERE state IN (?, ?, ?, ?)
        AND retry_ms_at <= strftime('%s','now') || substr(strftime('%f','now'), 4)
    ORDER BY retry_ms_at ASC
    LIMIT 5;
    "#;...

Currently we only get the top 5 failed requests, that should be retried earliest. This means if a certain origin/domain had lots of failing requests at same time, it would delay failing requests from other origins/domains from getting retried. I suggest we fetch x requests per domain/origin that should be retried at earliest to make the system be fair. What are your thoughts?

@hjr3
Copy link
Owner

hjr3 commented Dec 31, 2023

Agreed. That is what my comment

This should probably be configurable on a per-origin basis

is implying. As I think about this, maybe per origin configuration is less important than updating this logic to be per origin.

@manpreeeeeet
Copy link
Author

I can try exploring this if you haven't already started.

@hjr3
Copy link
Owner

hjr3 commented Jan 20, 2024

@manpreeeeeet you can give it a go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants