Drive-by: use one Entry for all logs.

This commit is contained in:
Ray J. Greenwell
2014-03-20 14:16:00 -07:00
parent 436c9f8621
commit 43d7e5b726
@@ -143,13 +143,14 @@ public class ChatHistory
msg.timestamp = System.currentTimeMillis(); msg.timestamp = System.currentTimeMillis();
} }
Entry entry = new Entry(channel, msg);
for (Name username : usernames) { for (Name username : usernames) {
// add the message to this user's chat history // add the message to this user's chat history
List<Entry> history = getList(username); List<Entry> history = getList(username);
if (history == null) { if (history == null) {
continue; continue;
} }
history.add(new Entry(channel, msg)); history.add(entry);
// if the history is big enough, potentially prune it (we always prune when asked for // if the history is big enough, potentially prune it (we always prune when asked for
// the history, so this is just to balance memory usage with CPU expense) // the history, so this is just to balance memory usage with CPU expense)