MCPcopy Create free account
hub / github.com/subquery/subql / updateBlockFetching

Method updateBlockFetching

packages/node/src/indexer/api.service.ts:239–277  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

237 }
238
239 updateBlockFetching(): void {
240 const onlyEventHandlers = isOnlyEventHandlers(this.project);
241 const skipTransactions =
242 this.nodeConfig.skipTransactions && onlyEventHandlers;
243
244 if (this.nodeConfig.skipTransactions) {
245 if (onlyEventHandlers) {
246 logger.info(
247 'skipTransactions is enabled, only events and block headers will be fetched.',
248 );
249 } else {
250 logger.info(
251 `skipTransactions is disabled, the project contains handlers that aren't event handlers.`,
252 );
253 }
254 } else {
255 if (onlyEventHandlers) {
256 logger.warn(
257 'skipTransactions is disabled, the project contains only event handlers, it could be enabled to improve indexing performance.',
258 );
259 } else {
260 logger.info(`skipTransactions is disabled.`);
261 }
262 }
263
264 const fetchFunc = skipTransactions
265 ? SubstrateUtil.fetchBlocksBatchesLight
266 : SubstrateUtil.fetchBlocksBatches;
267
268 if (this.nodeConfig?.profiler) {
269 this._fetchBlocksFunction = profilerWrap(
270 fetchFunc,
271 'SubstrateUtil',
272 'fetchBlocksBatches',
273 );
274 } else {
275 this._fetchBlocksFunction = fetchFunc;
276 }
277 }
278
279 get api(): ApiPromise {
280 return this.unsafeApi;

Callers 3

constructorMethod · 0.95
onProjectChangeMethod · 0.80
onProjectChangeMethod · 0.80

Calls 3

isOnlyEventHandlersFunction · 0.90
profilerWrapFunction · 0.90
warnMethod · 0.45

Tested by 1

onProjectChangeMethod · 0.64