Skip to content

Commit 9a0b118

Browse files
dependabot[bot]lutter
authored andcommitted
build(deps): bump diesel-async from 0.8.0 to 0.9.0
Bumps [diesel-async](https://github.com/weiznich/diesel_async) from 0.8.0 to 0.9.0. - [Release notes](https://github.com/weiznich/diesel_async/releases) - [Changelog](https://github.com/diesel-rs/diesel_async/blob/main/CHANGELOG.md) - [Commits](diesel-rs/diesel_async@v0.8.0...v0.9.0) --- updated-dependencies: - dependency-name: diesel-async dependency-version: 0.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
1 parent 66b9768 commit 9a0b118

14 files changed

Lines changed: 736 additions & 794 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ diesel = { version = "2.2.7", features = [
6161
"chrono",
6262
"i-implement-a-third-party-backend-and-opt-into-breaking-changes",
6363
] }
64-
diesel-async = { version = "0.8.0", features = ["deadpool", "async-connection-wrapper", "tokio", "postgres"] }
64+
diesel-async = { version = "0.9.0", features = ["deadpool", "async-connection-wrapper", "tokio", "postgres"] }
6565
diesel-derive-enum = { version = "2.1.0", features = ["postgres"] }
6666
diesel-dynamic-schema = { version = "0.2.3", features = ["postgres"] }
6767
diesel_derives = "2.3.8"

node/src/manager/commands/chain.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use graph_chain_ethereum::chain::BlockFinality;
2525
use graph_store_postgres::BlockStore;
2626
use graph_store_postgres::ChainStore;
2727
use graph_store_postgres::PoolCoordinator;
28-
use graph_store_postgres::ScopedFutureExt;
2928
use graph_store_postgres::Shard;
3029
use graph_store_postgres::add_chain;
3130
use graph_store_postgres::find_chain;
@@ -260,34 +259,35 @@ pub async fn change_block_cache_shard(
260259
let new_name = format!("{}-old", &chain_name);
261260
let ident = chain_store.chain_identifier().await?;
262261

263-
conn.transaction::<(), StoreError, _>(|conn| {
264-
async {
265-
let shard = Shard::new(shard.to_string())?;
262+
conn.transaction::<(), StoreError, _>(async |conn| {
263+
let shard = Shard::new(shard.to_string())?;
266264

267-
let chain = BlockStore::allocate_chain(conn, &chain_name, &shard, &ident).await?;
265+
let chain = BlockStore::allocate_chain(conn, &chain_name, &shard, &ident).await?;
268266

269-
store.add_chain_store(&chain, true).await?;
267+
store.add_chain_store(&chain, true).await?;
270268

271-
// Drop the foreign key constraint on deployment_schemas
272-
sql_query(
273-
"alter table deployment_schemas drop constraint deployment_schemas_network_fkey;",
274-
)
275-
.execute(conn).await?;
269+
// Drop the foreign key constraint on deployment_schemas
270+
sql_query(
271+
"alter table deployment_schemas drop constraint deployment_schemas_network_fkey;",
272+
)
273+
.execute(conn)
274+
.await?;
276275

277-
// Update the current chain name to chain-old
278-
update_chain_name(conn, &chain_name, &new_name).await?;
276+
// Update the current chain name to chain-old
277+
update_chain_name(conn, &chain_name, &new_name).await?;
279278

280-
// Create a new chain with the name in the destination shard
281-
let _ = add_chain(conn, &chain_name, &shard, ident).await?;
279+
// Create a new chain with the name in the destination shard
280+
let _ = add_chain(conn, &chain_name, &shard, ident).await?;
282281

283-
// Re-add the foreign key constraint
284-
sql_query(
285-
"alter table deployment_schemas add constraint deployment_schemas_network_fkey foreign key (network) references chains(name);",
286-
)
287-
.execute(conn).await?;
288-
Ok(())
289-
}.scope_boxed()
290-
}).await?;
282+
// Re-add the foreign key constraint
283+
sql_query(
284+
"alter table deployment_schemas add constraint deployment_schemas_network_fkey foreign key (network) references chains(name);",
285+
)
286+
.execute(conn)
287+
.await?;
288+
Ok(())
289+
})
290+
.await?;
291291

292292
chain_store.update_name(&new_name).await?;
293293

store/postgres/src/block_store.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use graph::{components::store::BLOCK_CACHE_SIZE, parking_lot::RwLock};
55
use anyhow::anyhow;
66
use async_trait::async_trait;
77
use diesel::{ExpressionMethods as _, QueryDsl, sql_query};
8-
use diesel_async::{RunQueryDsl, scoped_futures::ScopedFutureExt};
8+
use diesel_async::RunQueryDsl;
99
use graph::{
1010
blockchain::ChainIdentifier,
1111
components::store::{BlockStore as BlockStoreTrait, QueryPermit},
@@ -253,9 +253,7 @@ impl BlockStore {
253253
const CHAIN_HEAD_CACHE_TTL: Duration = Duration::from_secs(2);
254254

255255
let mirror = PrimaryMirror::new(&pools);
256-
let existing_chains = mirror
257-
.read_async(|conn| primary::load_chains(conn).scope_boxed())
258-
.await?;
256+
let existing_chains = mirror.read_async(primary::load_chains).await?;
259257
let chain_head_cache = TimedCache::new(CHAIN_HEAD_CACHE_TTL);
260258
let chains = shards.clone();
261259

@@ -437,18 +435,15 @@ impl BlockStore {
437435
let chain = chain.to_string();
438436
let this = self.cheap_clone();
439437
self.mirror
440-
.read_async(|conn| {
441-
async {
442-
match primary::find_chain(conn, &chain).await? {
443-
Some(chain) => {
444-
let chain_store = this.add_chain_store(&chain, false).await?;
445-
Ok(Some(chain_store))
446-
}
447-
None => Ok(None),
438+
.read_async(
439+
async |conn| match primary::find_chain(conn, &chain).await? {
440+
Some(chain) => {
441+
let chain_store = this.add_chain_store(&chain, false).await?;
442+
Ok(Some(chain_store))
448443
}
449-
}
450-
.scope_boxed()
451-
})
444+
None => Ok(None),
445+
},
446+
)
452447
.await
453448
}
454449

0 commit comments

Comments
 (0)