algorandfoundation / algokit-subscriber-ts

Simple, but flexible / configurable Algorand transaction subscription / indexing mechanism
MIT License
12 stars 6 forks source link

fix: call poll handler before storing watermark #60

Closed neilcampbell closed 5 months ago

neilcampbell commented 5 months ago

Currently watermarkPersistence.set is called before the poll handler is invoked. This means that if the poll handler throws, the new watermark has already been stored, and could result in missed data on recovery.

This PR adjusts where the poll handler is called.

An added benefit of this change is that you can reliably use the watermark as a consistency guarantee, ensuring that all data has been successfully processed up to that round.