The createId() method is supposed to create unique subscription ids, but as it is implemented today it may create duplicate id's when several id's is generated during the same millisecond, since it just appends a random number between 0-1000 to the current millisecond.
The method must ensure to never return an id that previously been returned. There are several options of doing this, e.g. keeping track and checking against the id's generated for the current millisecond is one way.
The createId() method is supposed to create unique subscription ids, but as it is implemented today it may create duplicate id's when several id's is generated during the same millisecond, since it just appends a random number between 0-1000 to the current millisecond.
The method must ensure to never return an id that previously been returned. There are several options of doing this, e.g. keeping track and checking against the id's generated for the current millisecond is one way.