Closed tadejgasparovic closed 4 years ago
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
_subscription
type
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); });
@tadejgasparovic looking into it
Fixed, thanks for raising this issue
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 atype
property. https://github.com/juicycleff/nestjs-event-store/blob/master/src/lib/event-store.ts#L285Solution: Check the constructor name instead of
type
property.Currently, this shim works for me.