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

deadpool diesel -> error Timeouts require a runtime #195

Closed
Cloud33 opened this issue Apr 23, 2022 · 2 comments
Closed

deadpool diesel -> error Timeouts require a runtime #195

Cloud33 opened this issue Apr 23, 2022 · 2 comments
Labels
A-core Area: Core / deadpool invalid The issue is invalid and has been raised in error.

Comments

@Cloud33
Copy link

Cloud33 commented Apr 23, 2022

toml:

diesel = { version = "1.4.8", features = ["postgres","chrono","uuid"] }
deadpool-diesel = { version = "0.3.1", features=["postgres","serde","rt_tokio_1"]}

code

    let manager = Manager::new(&database_url, Runtime::Tokio1);
    let pool = Pool::builder(manager)
        .max_size(max_connections)
        .wait_timeout(Some(Duration::from_millis(5000)))
        .create_timeout(Some(Duration::from_millis(5000)))
        .recycle_timeout(Some(Duration::from_millis(5000)))
        .build()?;

error:

Error occurred while building the pool: NoRuntimeSpecified: Timeouts require a runtime'

Why, I have a specified runtime

@bikeshedder bikeshedder added bug Category: This is a bug. A-core Area: Core / deadpool enhancement New feature or request and removed bug Category: This is a bug. labels Apr 27, 2022
@bikeshedder
Copy link
Owner

bikeshedder commented Apr 27, 2022

That's quite unfortunate. The Manager and the Pool are separate structures.

For the PoolBuilder to know the Runtime you need to call .runtime(Runtime::Tokio) on it as well.

This might indeed be a convenience feature if the PoolBuilder could read the runtime from the Manager object. Right now the Pool has no way of knowing which Runtime was passed to the Manager and therefore you need to call that method on the PoolBuilder as well.

The way managers and pools are constructed have always bugged me. I just created issue #197 to track the progress of this.

@bikeshedder bikeshedder added invalid The issue is invalid and has been raised in error. and removed enhancement New feature or request labels Apr 27, 2022
@Cloud33
Copy link
Author

Cloud33 commented Apr 28, 2022

Thank you for your efforts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core / deadpool invalid The issue is invalid and has been raised in error.
Projects
None yet
Development

No branches or pull requests

2 participants