I have some question, I have some sequence number, examp 123456
when some user get that sequence number (from file, redis or db) and increment thats sequence.
let says
user1 get 123456
user2 get 123456
user3 get 123456
user4 get 123456
user5 get 123456
user6 get 123456
user7 get 123456
and my question is, how nodeJS can handle this problem in simultan request? because i hope i can get this
let says
user1 get 123456
user2 get 123457
user3 get 123458
user4 get 123459
user5 get 123460
user6 get 123461
user7 get 123462
because when i request one by one, thats no problem, but when i use looping 1-7, it seem the request was process simultaneously, that why every user get same id.
let firstData = result[0]; < ---- get from promise (db, redis or something
nextData = firstData + 1;
console.log(userid+" "+nextData);
via Susan Lie
No comments:
Post a Comment