Skip to content

Commit bf3121b

Browse files
fix subgraph invalid data
Co-authored-by: Copilot <[email protected]>
1 parent 7479380 commit bf3121b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/src/subgraph/trigger_processor.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,13 @@ where
316316
// This ensures triggers from the same data source/subgraph are always routed to
317317
// the same shard, maintaining cache locality.
318318
let data_source_name = triggers[0].host.data_source().name();
319+
// Use a unique fallback for invalid data source names to avoid sharding hotspots.
320+
let deployment_id = triggers[0].host.deployment_id().as_str();
319321
let deployment_hash = DeploymentHash::new(data_source_name)
320-
.unwrap_or_else(|_| DeploymentHash::new("unknown").unwrap());
322+
.unwrap_or_else(|_| {
323+
let fallback = format!("{}_{}", deployment_id, data_source_name);
324+
DeploymentHash::new(&fallback).unwrap()
325+
});
321326

322327
// Determine shard assignment
323328
let shard_id = if self.config.enable_sharding {

0 commit comments

Comments
 (0)