Fix double status increment on cached message relay
This commit is contained in:
parent
295e2a8596
commit
dad05449cf
@ -10,8 +10,8 @@ import java.util.logging.Logger;
|
|||||||
import envoy.util.EnvoyLog;
|
import envoy.util.EnvoyLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores elements in a queue to process them later.<br>
|
* Stores elements in a queue to process them later.
|
||||||
* <br>
|
* <p>
|
||||||
* Project: <strong>envoy-client</strong><br>
|
* Project: <strong>envoy-client</strong><br>
|
||||||
* File: <strong>Cache.java</strong><br>
|
* File: <strong>Cache.java</strong><br>
|
||||||
* Created: <strong>6 Feb 2020</strong><br>
|
* Created: <strong>6 Feb 2020</strong><br>
|
||||||
@ -40,6 +40,9 @@ public class Cache<T> implements Consumer<T>, Serializable {
|
|||||||
elements.offer(element);
|
elements.offer(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() { return String.format("Cache[elements=" + elements + "]"); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the processor to which cached elements are relayed.
|
* Sets the processor to which cached elements are relayed.
|
||||||
*
|
*
|
||||||
|
@ -47,9 +47,6 @@ public class WriteProxy {
|
|||||||
try {
|
try {
|
||||||
logger.log(Level.FINER, "Sending cached " + msg);
|
logger.log(Level.FINER, "Sending cached " + msg);
|
||||||
client.sendMessage(msg);
|
client.sendMessage(msg);
|
||||||
|
|
||||||
// Update message state to SENT in localDB
|
|
||||||
localDB.getMessage(msg.getID()).ifPresent(Message::nextStatus);
|
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
logger.log(Level.SEVERE, "Could not send cached message: ", e);
|
logger.log(Level.SEVERE, "Could not send cached message: ", e);
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,7 @@ public final class ChatScene {
|
|||||||
private void userListClicked() {
|
private void userListClicked() {
|
||||||
final Contact user = userList.getSelectionModel().getSelectedItem();
|
final Contact user = userList.getSelectionModel().getSelectedItem();
|
||||||
if (user != null && (currentChat == null || !user.equals(currentChat.getRecipient()))) {
|
if (user != null && (currentChat == null || !user.equals(currentChat.getRecipient()))) {
|
||||||
|
logger.log(Level.FINEST, "Loading chat with " + user);
|
||||||
contactLabel.setText(user.getName());
|
contactLabel.setText(user.getName());
|
||||||
|
|
||||||
// LEON: JFC <===> JAVA FRIED CHICKEN <=/=> Java Foundation Classes
|
// LEON: JFC <===> JAVA FRIED CHICKEN <=/=> Java Foundation Classes
|
||||||
|
Reference in New Issue
Block a user