mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 08:50:51 +01:00
Fix ForumThread
This commit is contained in:
parent
fc82db6dec
commit
d54b9dba92
@ -123,13 +123,13 @@ public class ForumThread implements Runnable, ISerialize {
|
||||
THashSet<ForumThread> threads = null;
|
||||
|
||||
if (guildThreadsCache.containsKey(guildId)) {
|
||||
guildThreadsCache.get(guildId);
|
||||
threads = guildThreadsCache.get(guildId);
|
||||
}
|
||||
|
||||
if (threads != null)
|
||||
return threads;
|
||||
|
||||
threads = new THashSet<ForumThread>();
|
||||
threads = new THashSet<>();
|
||||
|
||||
guildThreadsCache.put(guildId, threads);
|
||||
|
||||
@ -141,8 +141,8 @@ public class ForumThread implements Runnable, ISerialize {
|
||||
"WHERE `id` IN (" +
|
||||
"SELECT MAX(id) " +
|
||||
"FROM `guilds_forums_comments` B " +
|
||||
"GROUP BY `thread_id` " +
|
||||
"ORDER BY B.`id` ASC " +
|
||||
"GROUP BY `thread_id` AND B.`id` " +
|
||||
"ORDER BY B.`id` " +
|
||||
") " +
|
||||
"ORDER BY `id` DESC " +
|
||||
") B ON A.`id` = B.`thread_id` " +
|
||||
@ -154,9 +154,7 @@ public class ForumThread implements Runnable, ISerialize {
|
||||
try (ResultSet set = statement.executeQuery()) {
|
||||
while (set.next()) {
|
||||
ForumThread thread = new ForumThread(set);
|
||||
synchronized (threads) {
|
||||
threads.add(thread);
|
||||
}
|
||||
cacheThread(thread);
|
||||
}
|
||||
}
|
||||
@ -182,8 +180,8 @@ public class ForumThread implements Runnable, ISerialize {
|
||||
"WHERE `id` IN (" +
|
||||
"SELECT MAX(id) " +
|
||||
"FROM `guilds_forums_comments` B " +
|
||||
"GROUP BY `thread_id` " +
|
||||
"ORDER BY B.`id` ASC " +
|
||||
"GROUP BY `thread_id` AND b.`id`" +
|
||||
"ORDER BY B.`id` " +
|
||||
") " +
|
||||
"ORDER BY `id` DESC " +
|
||||
") B ON A.`id` = B.`thread_id` " +
|
||||
@ -219,11 +217,8 @@ public class ForumThread implements Runnable, ISerialize {
|
||||
guildThreadsCache.put(thread.guildId, guildThreads);
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (guildThreads) {
|
||||
guildThreads.add(thread);
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
for (THashSet<ForumThread> threads : guildThreadsCache.values()) {
|
||||
|
Loading…
Reference in New Issue
Block a user