vkuznet / transfer2go

Distributed, loosely couple agent-based transferring system
MIT License
8 stars 2 forks source link

Improve unique id generator #39

Closed rishiloyola closed 7 years ago

vkuznet commented 7 years ago

Rishi, out of curiosity, why Unix time is not sufficient for Id?

rishiloyola commented 7 years ago

While registering 10 requests together in bulk during the tests I can see some of the requests are getting same ids and due to that our agent is throwing errors.

We are serving all the requests parallelly so there are high chances to get the same ids.

vkuznet commented 7 years ago

Well, why not to use UnixNano(), in fact snowflakes code uses just that: https://github.com/bwmarrin/snowflake/blob/master/snowflake.go#L82

On 0, Rishi notifications@github.com wrote:

While registering 10 requests together in bulk during the tests I can see some of the requests are getting same ids and due to that our agent is throwing errors.

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/vkuznet/transfer2go/pull/39#issuecomment-322456716

rishiloyola commented 7 years ago

@vkuznet okay, I reset my branch and used UnixNano. You can merge this.