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