更新用户信息时,先写入数据库再存入缓存中,防止异步操作写入数据库失败造成数据不一致

This commit is contained in:
heavyrain.lee
2020-01-10 10:25:34 +08:00
parent bace7ec70c
commit 9eb5fdd805
7 changed files with 39 additions and 10 deletions
@@ -2128,7 +2128,7 @@ public class DatabaseStore {
});
}
void updateUser(final WFCMessage.User user) {
void updateUser(final WFCMessage.User user) throws Exception {
LOG.info("Database update user info {} {}", user.getUid(), user.getUpdateDt());
Connection connection = null;
PreparedStatement statement = null;
@@ -2202,6 +2202,7 @@ public class DatabaseStore {
// TODO Auto-generated catch block
e.printStackTrace();
Utility.printExecption(LOG, e);
throw new Exception(e.getMessage());
} finally {
DBUtil.closeDB(connection, statement);
}