1
0
mirror of synced 2026-04-15 04:48:39 +08:00

优化时间回拨处理逻辑

This commit is contained in:
yitter
2022-09-15 22:42:14 +08:00
parent fe22bfb7e2
commit 5cd28244fc
13 changed files with 121 additions and 100 deletions

View File

@@ -69,10 +69,11 @@ static inline int64_t NextNormalId(SnowFlakeWorker *worker) {
if (currentTimeTick < worker->_LastTimeTick) {
if (worker->_TurnBackTimeTick < 1) {
worker->_TurnBackTimeTick = worker->_LastTimeTick - 1;
worker->_TurnBackIndex++;
if (worker->_TurnBackIndex > 4) {
worker->_TurnBackIndex = 1;
}
}
worker->_TurnBackIndex++;
if (worker->_TurnBackIndex > 4) {
worker->_TurnBackIndex = 1;
}
// usleep(1000); // 暂停1ms