Skip to content

Commit d8bd900

Browse files
committed
fix: clean up changes and better comments
1 parent 3dd5387 commit d8bd900

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Experimental rust impl for The Graph [indexer service](https://github.com/graphp
1414
1515
## Components checklist (basic, not extensive)
1616

17-
- [ ] Server path routing
17+
- [x] Server path routing
1818
- [x] basic structure
1919
- [x] CORS
2020
- [x] timeouts

service/src/common/indexer_management_client/resolver.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ use crate::common::{
1010
};
1111

1212
/// Query postgres indexer management server's cost models
13-
/// Filter on deployments if it is not empty, otherwise return all cost models
13+
/// If specific deployments is provided, then global fallback is applied to all
14+
/// deployments regardless of its presence in the database. Otherwise, all cost
15+
/// models are returned without merging fields with the global cost model
1416
pub async fn cost_models(
1517
pool: &PgPool,
1618
deployments: &[String],
@@ -212,9 +214,9 @@ mod test {
212214
#[sqlx::test]
213215
#[ignore]
214216
async fn success_cost_models(pool: PgPool) {
215-
_ = setup_cost_models_table(&pool).await;
217+
setup_cost_models_table(&pool).await;
216218
let expected_models = simple_cost_models();
217-
_ = add_cost_models(&pool, expected_models.clone()).await;
219+
add_cost_models(&pool, expected_models.clone()).await;
218220
let res = cost_models(
219221
&pool,
220222
&["Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss".to_string()],
@@ -255,10 +257,10 @@ mod test {
255257
async fn global_fallback_cost_models(pool: PgPool) {
256258
let deployment_id =
257259
"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".to_string();
258-
_ = setup_cost_models_table(&pool).await;
259-
_ = add_cost_models(&pool, simple_cost_models()).await;
260+
setup_cost_models_table(&pool).await;
261+
add_cost_models(&pool, simple_cost_models()).await;
260262
let global = global_cost_model();
261-
_ = add_cost_models(&pool, vec![global.clone()]).await;
263+
add_cost_models(&pool, vec![global.clone()]).await;
262264
let res = cost_models(&pool, &[])
263265
.await
264266
.expect("Cost models query without deployments filter");
@@ -306,8 +308,8 @@ mod test {
306308
async fn success_cost_model(pool: PgPool) {
307309
let deployment_id = "0xbd499f7673ca32ef4a642207a8bebdd0fb03888cf2678b298438e3a1ae5206ea";
308310
let deployment_hash = "Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss".to_string();
309-
_ = setup_cost_models_table(&pool).await;
310-
_ = add_cost_models(&pool, simple_cost_models()).await;
311+
setup_cost_models_table(&pool).await;
312+
add_cost_models(&pool, simple_cost_models()).await;
311313
let res = cost_model(&pool, &deployment_hash)
312314
.await
313315
.expect("Cost model query")
@@ -320,8 +322,8 @@ mod test {
320322
#[ignore]
321323
async fn global_fallback_cost_model(pool: PgPool) {
322324
let deployment_hash = "Qmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
323-
_ = setup_cost_models_table(&pool).await;
324-
_ = add_cost_models(&pool, simple_cost_models()).await;
325+
setup_cost_models_table(&pool).await;
326+
add_cost_models(&pool, simple_cost_models()).await;
325327

326328
let res = cost_model(&pool, deployment_hash)
327329
.await
@@ -330,7 +332,7 @@ mod test {
330332
assert!(res.is_none());
331333

332334
let global = global_cost_model();
333-
_ = add_cost_models(&pool, vec![global.clone()]).await;
335+
add_cost_models(&pool, vec![global.clone()]).await;
334336

335337
let res = cost_model(&pool, deployment_hash)
336338
.await

service/src/server/routes/cost.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ pub(crate) async fn graphql_handler(
1111
Extension(schema): Extension<CostSchema>,
1212
Extension(server_options): Extension<ServerOptions>,
1313
) -> GraphQLResponse {
14-
let response = async move { schema.execute(req.into_inner().data(server_options)).await }.await;
15-
response.into()
14+
schema.execute(req.into_inner().data(server_options)).await.into()
1615
}

0 commit comments

Comments
 (0)