Catchup Checkpoint Not Updating
tadejgasparovic opened this issue · comments
Tadej Gašparovič commented
When using a catchup subscription with a store for persisting checkpoints the store only gets read from on start and never written to. This occurs because _subscription
doesn't have a type
property.
https://github.com/juicycleff/nestjs-event-store/blob/master/src/lib/event-store.ts#L285
Solution:
Check the constructor name instead of type
property.
Currently, this shim works for me.
const _onEvent = Reflect.get(EventStore.prototype, 'onEvent');
Reflect.set(EventStore.prototype, 'onEvent', async function(_sub, event) {
console.log(_sub.constructor.name === 'EventStoreStreamCatchUpSubscription'); // true
return _onEvent.call(this, Object.assign(_sub, { type: 'catch' }), event);
});
Rex Raphael commented
@tadejgasparovic looking into it
Rex Raphael commented
Fixed, thanks for raising this issue