-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
Log a warning if PG startup takes too long #924
Conversation
martin/src/pg/config.rs
Outdated
@@ -110,8 +114,18 @@ impl PgConfig { | |||
|
|||
pub async fn resolve(&mut self, id_resolver: IdResolver) -> crate::Result<Sources> { | |||
let pg = PgBuilder::new(self, id_resolver).await?; | |||
|
|||
let instantiate_tables = pg.instantiate_tables(); | |||
pin_mut!(instantiate_tables); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should go inside the fn instantiate_tables()
because otherwise you are not simultaneously instantiating tables AND functions. Instead, you instantiate tables for 5 seconds or until complet, and only then start instantiating functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the mixup there! This updated version should work as expected, but I wrapped the entire instantiate_tables
function because there are multiple futures awaited inside of it and I wasn't sure the best way to go about that
c2591d9
to
c8e9c0e
Compare
This makes the functionality reusable
Cleaner approach to timeout reporting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx!
Adds a warning message using the suggested implementation in #810. Thanks for the recommended approach in the ticket! This one seemed straightforward enough that local tests would do, which I ran by adding a delay to
instantiate_tables
.I'm getting a clippy error locally for having
Deserialize
on a type with methods usingunsafe
, but it looks like that might be a more significant update.Fixes #810