In one of our implementations we need to make quite a few internal service calls and the services expect the calls to have a unique request id (max 12 chars). Whats the best way to generate them from Apihub? With the elastic pods expansion we wont be able to use npm uuid as it cannot be made unique across a cluster of pods (if i am correct). We tried to use custom objects in commercetools to store and retrieve a running number and increasing that on every call to get an incremented value -- but with this being called from every pod and there are so many of them during peak load + there are so many different services that need a running number, we see a lost of 409s due to incrementing the custom object value. Any one has done such a thing in their implementations ? Any suggestion / pointers ?
Page 1 / 1
What about using a epoch time?
The epoch time that will be always incremented naturally :)
What do you think about this idea?
function generateId() {
const epochTimeMillis = Date.now();
const epochString = epochTimeMillis.toString();
const epoch12Char = epochString.slice(-12);
return epoch12Char;
}
Regards,
Obed
Thanks
Reply
Sign up
Already have an account? Login
Connect with (or create) your commercetools ID
commercetools IDEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.