Skip to content

Commit 6c786c0

Browse files
store: Handle materialized view not being populated
Signed-off-by: Maksim Dimitrov <[email protected]>
1 parent dfa689c commit 6c786c0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

store/postgres/src/detail.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,19 @@ fn deployment_sizes(
480480
"#,
481481
);
482482

483-
let rows = if sites.is_empty() {
484-
diesel::sql_query(query).load::<SubgraphSizeRow>(conn)?
483+
let result = if sites.is_empty() {
484+
diesel::sql_query(query).load::<SubgraphSizeRow>(conn)
485485
} else {
486486
query.push_str(" WHERE ds.id = ANY($1)");
487487
diesel::sql_query(query)
488488
.bind::<Array<Integer>, _>(sites.iter().map(|site| site.id).collect::<Vec<_>>())
489-
.load::<SubgraphSizeRow>(conn)?
489+
.load::<SubgraphSizeRow>(conn)
490+
};
491+
492+
let rows = match result {
493+
Ok(rows) => rows,
494+
Err(e) if e.to_string().contains("has not been populated") => Vec::new(),
495+
Err(e) => return Err(e.into()),
490496
};
491497

492498
let mut sizes: HashMap<DeploymentId, status::SubgraphSize> = HashMap::new();

0 commit comments

Comments
 (0)