Hey,
I try to setup a new projection to let me access events by date:
function p2(n) {
return n < 10 ? ‘0’ + n : String(n);
}
fromAll()
.when({ $any: function (state, event) {
if (event.metadata == null) return ;
if (event.metadata.createdAt == null) return ;
if (typeof event.metadata.createdAt != ‘number’) return ;
const date = new Date(event.metadata.createdAt);
const YMDHm = date.getFullYear() + p2(date.getMonth() + 1) + p2(date.getDate())
+ ‘-’ + p2(date.getHours()) + p2(date.getMinutes());
linkTo(‘DateYMDHm-’ + YMDHm, event);
} });
``
but when running (not 100%) after about 2 minutes, persistents & catchup subscriptions slow down, then hangs, sockets sometime break…
if I stop the projection after a while the system began available again.
For information, projection consumes about 3k events / s