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

pyvespa 0.46.0+ total_timeout is not passed #950

Closed
dzianis-kryvapusk opened this issue Oct 9, 2024 · 1 comment
Closed

pyvespa 0.46.0+ total_timeout is not passed #950

dzianis-kryvapusk opened this issue Oct 9, 2024 · 1 comment
Assignees
Milestone

Comments

@dzianis-kryvapusk
Copy link

The issue exists since 0.46.0.
I have the following code to invoke the query

v_client = Vespa(settings.endpoint, cert=settings.vespa_cert_file)
async with v_client.asyncio(total_timeout=300) as async_client:
     req['timeout'] = '300s',
     resp = await async_client.query(body=req)

When the query runs for longer than 10sec it fails with the following error:
RetryError[<Future at 0x1b1c93b70a0 state=finished raised ReadTimeout>
To reproduce the issue, try to use the following searcher:

@After(MinimalQueryInserter.EXTERNAL_YQL)
public class SleepSearcher extends Searcher {
    @Override
    public Result search(Query query, Execution execution) {
        Result result = execution.search(query);

        Integer timeToSleep = getValue(query);
        if (timeToSleep != null) {
            try {
                TimeUnit.SECONDS.sleep(timeToSleep);
            } catch (InterruptedException e) {
                return result;
            }
        }
        return result;
    }

    private Integer getValue(Query query) {
        try {
            return Integer.parseInt(query.properties().getString(new CompoundName("sleep")));
        } catch (NullPointerException | NumberFormatException e) {
            return null;
        }
    }
}

Then, pass req['sleep'] = '20'.

@thomasht86
Copy link
Collaborator

This is now fixed in ltest release (0.50.0).
Thanks for reporting.

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

3 participants