用户状态和频道订阅状态修改改成同步模式,防止高并发时出现问题

This commit is contained in:
heavyrian2012
2023-04-13 09:18:43 +08:00
parent 62b36cd2b4
commit afee0466e7
@@ -2411,7 +2411,6 @@ public class DatabaseStore {
} }
void deleteUserStatus(String userId) { void deleteUserStatus(String userId) {
mScheduler.execute(()->{
Connection connection = null; Connection connection = null;
PreparedStatement statement = null; PreparedStatement statement = null;
try { try {
@@ -2428,11 +2427,9 @@ public class DatabaseStore {
} finally { } finally {
DBUtil.closeDB(connection, statement); DBUtil.closeDB(connection, statement);
} }
});
} }
void updateUserStatus(String userId, int status) { void updateUserStatus(String userId, int status) {
mScheduler.execute(()->{
Connection connection = null; Connection connection = null;
PreparedStatement statement = null; PreparedStatement statement = null;
try { try {
@@ -2463,7 +2460,6 @@ public class DatabaseStore {
} finally { } finally {
DBUtil.closeDB(connection, statement); DBUtil.closeDB(connection, statement);
} }
});
} }
int getGeneratedId() { int getGeneratedId() {
@@ -3342,8 +3338,7 @@ public class DatabaseStore {
} }
void updateChannelListener(final String channelId, final String listener, final boolean listen) { void updateChannelListener(final String channelId, final String listener, final boolean listen) {
LOG.info("Database remove channel {}", channelId); LOG.info("updateChannelListener channel {}, listener {}, listen {}", channelId, listener, listen);
mScheduler.execute(()->{
Connection connection = null; Connection connection = null;
PreparedStatement statement = null; PreparedStatement statement = null;
try { try {
@@ -3382,7 +3377,6 @@ public class DatabaseStore {
} finally { } finally {
DBUtil.closeDB(connection, statement); DBUtil.closeDB(connection, statement);
} }
});
} }
List<String> getUserChannels(String userId) { List<String> getUserChannels(String userId) {