graph-node
graph-node copied to clipboard
Initialization handlers
Subgraph developers often want to initialise a specific state for their subgraph.
Currently this needs to be done across handlers, or on the basis of some other trigger.
TBD: could parts of this use case be handled declaratively in the manifest e.g. via context?
This was proposed separately in the Forum: https://forum.thegraph.com/t/grp-0001-decorator-hooks-cron-jobs-and-initialisation-handlers/3347
This could be a type
of block handler, similar to #959:
blockHandlers
- handler: initializeState
filter:
kind: once
@azf20 I like that, we'd just need to make sure it runs before any other triggers in the first block, rather than after as would be the default for a block handler.
Interesting - I wonder if that could be a separate blockHandler configuration, unless that seems like too much of a footgun?
It does seem interesting to have a separate configuration to make any block handler be handled first. Like a field order: first|last
, defaulting to last
.
@azf20 I like that, we'd just need to make sure it runs before any other triggers in the first block, rather than after as would be the default for a block handler.
Could we make it start 1 block before the earliest startblocks stated in subgraph.yaml
thus ensuring no other handlers are triggered?
Hey, is there an ETA on this?