File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -316,8 +316,13 @@ where
316
316
// This ensures triggers from the same data source/subgraph are always routed to
317
317
// the same shard, maintaining cache locality.
318
318
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 ( ) ;
319
321
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
+ } ) ;
321
326
322
327
// Determine shard assignment
323
328
let shard_id = if self . config . enable_sharding {
You can’t perform that action at this time.
0 commit comments