Closed fabiolimace closed 4 years ago
Make the TimeIdCreator wait the next millisecond instead of throwing a TsidCreatorException.
TimeIdCreator
TsidCreatorException
Twitter Snowflake also waits the next millisecond:
sequence number - 12 bits - rolls over every 4096 per machine (with protection to avoid rollover in the same ms)
protected def tilNextMillis(lastTimestamp: Long): Long = { var timestamp = timeGen() while (timestamp <= lastTimestamp) { timestamp = timeGen() } timestamp }
See this line: https://github.com/twitter-archive/snowflake/blob/b3f6a3c6ca8e1b6847baa6ff42bf72201e2c2231/src/main/scala/com/twitter/service/snowflake/IdWorker.scala#L97
See the commit ebc864b2f8942b1be783f3d3030c29e556013235
New version: 2.3.0
Make the
TimeIdCreator
wait the next millisecond instead of throwing aTsidCreatorException
.Twitter Snowflake also waits the next millisecond:
See this line: https://github.com/twitter-archive/snowflake/blob/b3f6a3c6ca8e1b6847baa6ff42bf72201e2c2231/src/main/scala/com/twitter/service/snowflake/IdWorker.scala#L97