Closed jsha closed 9 years ago
Updated title to better reflect what happens when this occurs. MySQL generates an error because of a duplicate primary key (uid), which winds up in the logs. Harmless, but obscures other, real errors in the logs. So maybe one other approach: If there's an error from the sequelize save command, don't bother logging it, or log it at INFO or even DEBUG level.
Fixed.
There's a race condition in storeUser: first it tries to load a user from the DB if it exists; Otherwise it creates one. In low traffic this isn't an issue, but in stream.js often there are multiple very closely-spaced calls to storeUser for the same user.
Options:
deactivatedAt
set. This way when a user gets unsuspended we record that fact as soon as possible. This has the side benefit of reducing the amount of work stream.js has to do, which can be a lot.