Skip to content

Commit 5c2811c

Browse files
store: Handle materialized view not being populated
Signed-off-by: Maksim Dimitrov <dimitrov.maksim@gmail.com>
1 parent 0f483c2 commit 5c2811c

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
@@ -492,13 +492,19 @@ fn deployment_sizes(
492492
"#,
493493
);
494494

495-
let rows = if sites.is_empty() {
496-
diesel::sql_query(query).load::<SubgraphSizeRow>(conn)?
495+
let result = if sites.is_empty() {
496+
diesel::sql_query(query).load::<SubgraphSizeRow>(conn)
497497
} else {
498498
query.push_str(" WHERE ds.id = ANY($1)");
499499
diesel::sql_query(query)
500500
.bind::<Array<Integer>, _>(sites.iter().map(|site| site.id).collect::<Vec<_>>())
501-
.load::<SubgraphSizeRow>(conn)?
501+
.load::<SubgraphSizeRow>(conn)
502+
};
503+
504+
let rows = match result {
505+
Ok(rows) => rows,
506+
Err(e) if e.to_string().contains("has not been populated") => Vec::new(),
507+
Err(e) => return Err(e.into()),
502508
};
503509

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

0 commit comments

Comments
 (0)