How to not lose data when adding stream entries rapidly
I've noticed that I lose data when stream entries are added very rapidly. This occurs due to the entries being added simultaneously in different threads. The stream cannot have data with the same timestamp, so only one of them gets added if there are multiple entries being added simultaneously. To prevent this from occurring, I've added random milliseconds to the timestamp. However, when so many entries are being added simultaneously, I lose data since the simultaneous entries still seems to occur even with the random milliseconds. Is there a better way to add stream entries without losing data?
var timestamp = new Date();
timestamp.setMilliseconds(Math.floor(Math.random() * 1000));
Things[StreamName].AddStreamEntry({
sourceType: undefined /* STRING */,
values: values /* INFOTABLE */,
location: undefined /* LOCATION */,
source: me.name /* STRING */,
timestamp: timstamp /* DATETIME */,
tags: tags /* TAGS */
});

