Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexer core #103

Merged
merged 26 commits into from
Nov 21, 2023
Merged

Indexer core #103

merged 26 commits into from
Nov 21, 2023

Conversation

bogdanfazakas
Copy link
Member

@bogdanfazakas bogdanfazakas commented Nov 9, 2023

Fixes #21 .

Changes proposed in this PR:

  • create config and take list of : RPC,chainId,chunkSize from env for every network,
    need to add chunkSize
  • for each network, start a working thread (use nodejs Working Threads)
  • should detect the block used to deploy the contracts from addresses.json
  • should store the last indexed block. if none, use above
    need db interaction to save the last indexed block and get the last indexed block
  • check network height, if > than last indexed block, process remaining blocks in chunks. If something fails, reduce chunk size to 1/2 and retry
  • based on event, use a specific processor
  • if something fails or processing of an event takes more that than a couple of secs, insert that event to a retry queue and move to next one

@bogdanfazakas bogdanfazakas changed the base branch from main to develop November 9, 2023 07:18
@bogdanfazakas bogdanfazakas changed the title WIP Indexer core Indexer core Nov 17, 2023
@bogdanfazakas bogdanfazakas marked this pull request as ready for review November 17, 2023 12:27
src/components/Indexer/utils.ts Outdated Show resolved Hide resolved
src/components/Indexer/crawlerThread.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@paulo-ocean paulo-ocean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bogdanfazakas
Just a couple of suggestions as i think you could make a little bit better use of our custom logger :-)
for instance, when you create the custom Logger you could specify the module as 'Indexer, rather than 'Database'

export const INDEXER_LOGGER: CustomNodeLogger = getCustomLoggerForModule(
  LOGGER_MODULE_NAMES.DATABASE, // INDEXER
  LOG_LEVELS_STR.LEVEL_INFO,
  defaultConsoleTransport
)

And when you're logging, you could set the log level directly by calling 'log(level,message,includeModuleName)' // include module name
instead of always setting log level before and after the message, like:

INDEXER_LOGGER.loggerOptions.level = LOG_LEVELS_STR.LEVEl_ERROR
INDEXER_LOGGER.logMessage('Error retrieving last indexed block')
INDEXER_LOGGER.loggerOptions.level = LOG_LEVELS_STR.LEVEL_INFO

thanks 👍

@bogdanfazakas
Copy link
Member Author

Hi @bogdanfazakas Just a couple of suggestions as i think you could make a little bit better use of our custom logger :-) for instance, when you create the custom Logger you could specify the module as 'Indexer, rather than 'Database'

export const INDEXER_LOGGER: CustomNodeLogger = getCustomLoggerForModule(
  LOGGER_MODULE_NAMES.DATABASE, // INDEXER
  LOG_LEVELS_STR.LEVEL_INFO,
  defaultConsoleTransport
)

And when you're logging, you could set the log level directly by calling 'log(level,message,includeModuleName)' // include module name instead of always setting log level before and after the message, like:

INDEXER_LOGGER.loggerOptions.level = LOG_LEVELS_STR.LEVEl_ERROR
INDEXER_LOGGER.logMessage('Error retrieving last indexed block')
INDEXER_LOGGER.loggerOptions.level = LOG_LEVELS_STR.LEVEL_INFO

thanks 👍

thanks for the hints, will update

src/utils/address.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@paulo-ocean paulo-ocean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright 👍

@bogdanfazakas bogdanfazakas merged commit 55e55de into develop Nov 21, 2023
5 checks passed
@bogdanfazakas bogdanfazakas deleted the feature/indexer-core branch November 21, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indexer core
3 participants