@@ -5,7 +5,7 @@ import Controller from '../controller/Controller.js';
55
66export class GCPolicy implements GCInterface {
77 protected endpointCount : Record < string , number > = { } ;
8- protected entityCount : Record < string , Record < string , number > > = { } ;
8+ protected entityCount : Map < string , Map < string , number > > = new Map ( ) ;
99 protected endpoints = new Set < string > ( ) ;
1010 protected entities : EntityPath [ ] = [ ] ;
1111 declare protected intervalId : ReturnType < typeof setInterval > ;
@@ -41,9 +41,9 @@ export class GCPolicy implements GCInterface {
4141 this . endpointCount [ key ] ++ ;
4242 paths . forEach ( path => {
4343 if ( ! ( path . key in this . endpointCount ) ) {
44- this . entityCount [ path . key ] = { } ;
44+ this . entityCount . set ( path . key , new Map ( ) ) ;
4545 }
46- this . entityCount [ path . key ] [ path . pk ] ++ ;
46+ this . entityCount . get ( path . key ) ! . set ( path . pk , ( this . entityCount . get ( path . key ) ! . get ( path . pk ) || 0 ) + 1 ) ;
4747 } ) ;
4848
4949 // decrement
@@ -57,7 +57,7 @@ export class GCPolicy implements GCInterface {
5757 if ( ! ( path . key in this . endpointCount ) ) {
5858 return ;
5959 }
60- this . entityCount [ path . key ] [ path . pk ] -- ;
60+ this . entityCount . get ( path . key ) ! . set ( path . pk , this . entityCount . get ( path . key ) ! . get ( path . pk ) ! - 1 ) ;
6161 } ) ;
6262 } ;
6363 } ;
0 commit comments