@@ -125,28 +125,11 @@ export abstract class BaseIndexerManager<
125125 vm . freeze ( async ( templateName : string , index : number ) => {
126126 await this . dynamicDsService . destroyDynamicDatasource ( templateName , blockHeight , index ) ;
127127
128- // Remove the destroyed datasource from current processing
129- // The datasource at the global index now has an endBlock set
130- const destroyedDsParam = this . dynamicDsService . getDatasourceParamByIndex ( index ) ;
131-
132- if ( ! destroyedDsParam ) {
133- logger . warn ( `Unable to filter destroyed datasource at index ${ index } - params not found` ) ;
134- return ;
135- }
136-
137- // Filter out the destroyed datasource by matching startBlock and args
128+ // Re-filter datasources to exclude the destroyed one
129+ // The destroyed datasource now has endBlock set, so filterDataSources will exclude it
138130 // Note: Reassigning filteredDataSources is intentional - subsequent handlers
139131 // within the same block will see the updated filtered list
140- filteredDataSources = filteredDataSources . filter ( ( fds ) => {
141- const fdsStartBlock = ( fds as any ) . startBlock ;
142- // For custom datasources, args are stored in processor.options
143- // For runtime datasources, they may be stored differently
144- const fdsArgs = JSON . stringify ( ( fds as any ) . processor ?. options || ( fds as any ) . options || { } ) ;
145- const paramArgs = JSON . stringify ( destroyedDsParam . args || { } ) ;
146-
147- // Keep datasource if it doesn't match the destroyed one
148- return ! ( fdsStartBlock === destroyedDsParam . startBlock && fdsArgs === paramArgs ) ;
149- } ) ;
132+ filteredDataSources = this . filterDataSources ( blockHeight , filteredDataSources ) ;
150133 } , 'destroyDynamicDatasource' ) ;
151134
152135 return vm ;
0 commit comments