File tree Expand file tree Collapse file tree 4 files changed +16
-5
lines changed
graph/src/components/store Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -527,7 +527,7 @@ where
527527 let store = & self . inputs . store ;
528528 if !ENV_VARS . disable_fail_fast && !store. is_deployment_synced ( ) {
529529 store
530- . unassign_subgraph ( )
530+ . pause_subgraph ( )
531531 . map_err ( |e| ProcessingError :: Unknown ( e. into ( ) ) ) ?;
532532
533533 // Use `Canceled` to avoiding setting the subgraph health to failed, an error was
Original file line number Diff line number Diff line change @@ -395,7 +395,7 @@ pub trait WritableStore: ReadStore + DeploymentCursorTracker {
395395 /// Cheap, cached operation.
396396 fn is_deployment_synced ( & self ) -> bool ;
397397
398- fn unassign_subgraph ( & self ) -> Result < ( ) , StoreError > ;
398+ fn pause_subgraph ( & self ) -> Result < ( ) , StoreError > ;
399399
400400 /// Load the dynamic data sources for the given deployment
401401 async fn load_dynamic_data_sources (
Original file line number Diff line number Diff line change @@ -358,6 +358,17 @@ impl SyncStore {
358358 } )
359359 }
360360
361+ fn pause_subgraph ( & self , site : & Site ) -> Result < ( ) , StoreError > {
362+ retry:: forever ( & self . logger , "unassign_subgraph" , || {
363+ let mut pconn = self . store . primary_conn ( ) ?;
364+ pconn. transaction ( |conn| -> Result < _ , StoreError > {
365+ let mut pconn = primary:: Connection :: new ( conn) ;
366+ let changes = pconn. pause_subgraph ( site) ?;
367+ self . store . send_store_event ( & StoreEvent :: new ( changes) )
368+ } )
369+ } )
370+ }
371+
361372 async fn load_dynamic_data_sources (
362373 & self ,
363374 block : BlockNumber ,
@@ -1722,8 +1733,8 @@ impl WritableStoreTrait for WritableStore {
17221733 self . is_deployment_synced . load ( Ordering :: SeqCst )
17231734 }
17241735
1725- fn unassign_subgraph ( & self ) -> Result < ( ) , StoreError > {
1726- self . store . unassign_subgraph ( & self . store . site )
1736+ fn pause_subgraph ( & self ) -> Result < ( ) , StoreError > {
1737+ self . store . pause_subgraph ( & self . store . site )
17271738 }
17281739
17291740 async fn load_dynamic_data_sources (
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ impl WritableStore for MockStore {
141141 unimplemented ! ( )
142142 }
143143
144- fn unassign_subgraph ( & self ) -> Result < ( ) , StoreError > {
144+ fn pause_subgraph ( & self ) -> Result < ( ) , StoreError > {
145145 unimplemented ! ( )
146146 }
147147
You can’t perform that action at this time.
0 commit comments