Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

业务中同一时间调用生成uuid,出现重复,应该当如何排查问题? #10

Open
hVenus opened this issue Dec 5, 2022 · 2 comments

Comments

@hVenus
Copy link

hVenus commented Dec 5, 2022

目前确定并非常驻内存服务,只是普通的api调用。一次一条数据。日志中显示两次访问的时间相同,精确到秒,但是出现了重复的uuid.
生成代码如下:

$config=["worker_id"=>1,"datacenter_id"=>2];
$client = new \SeasSnowflake($config);
$id= $client->generate();
return $id;

这代码是否有不妥之处?

@Slairmy
Copy link

Slairmy commented Dec 6, 2022

目前确定并非常驻内存服务,只是普通的api调用。一次一条数据。日志中显示两次访问的时间相同,精确到秒,但是出现了重复的uuid. 生成代码如下:

$config=["worker_id"=>1,"datacenter_id"=>2];
$client = new \SeasSnowflake($config);
$id= $client->generate();
return $id;

这代码是否有不妥之处?
写个单测 看看能不能复现?

@hVenus
Copy link
Author

hVenus commented Sep 13, 2023

又出现重复ID了。 这次频率提高了,一个月出现两次,间隔快两个星期。
程序监听MT和ELE的推送数据,worker_id 和 datacenter相同,按文档上说datacenter相同的话,同一时间到达会产生相同ID,立马改了datacenter. 一个是2一个是3,隔了快两个星期,今天又出现相同ID。
这个问题该如何排查?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants