Include requested messages when getting next send time.

This commit is contained in:
akwizgran
2018-02-22 12:46:33 +00:00
parent 6dc7277771
commit 10f63ad60b
2 changed files with 5 additions and 2 deletions

View File

@@ -1938,8 +1938,7 @@ abstract class JdbcDatabase implements Database<Connection> {
String sql = "SELECT expiry FROM statuses" String sql = "SELECT expiry FROM statuses"
+ " WHERE contactId = ? AND state = ?" + " WHERE contactId = ? AND state = ?"
+ " AND groupShared = TRUE AND messageShared = TRUE" + " AND groupShared = TRUE AND messageShared = TRUE"
+ " AND deleted = FALSE" + " AND deleted = FALSE AND seen = FALSE"
+ " AND seen = FALSE AND requested = FALSE"
+ " ORDER BY expiry LIMIT 1"; + " ORDER BY expiry LIMIT 1";
ps = txn.prepareStatement(sql); ps = txn.prepareStatement(sql);
ps.setInt(1, c.getInt()); ps.setInt(1, c.getInt());

View File

@@ -1653,6 +1653,10 @@ public abstract class JdbcDatabaseTest extends BrambleTestCase {
db.setMessageShared(txn, messageId); db.setMessageShared(txn, messageId);
assertEquals(0, db.getNextSendTime(txn, contactId)); assertEquals(0, db.getNextSendTime(txn, contactId));
// Mark the message as requested - it should still be sendable
db.raiseRequestedFlag(txn, contactId, messageId);
assertEquals(0, db.getNextSendTime(txn, contactId));
// Update the message's expiry time as though we sent it - now the // Update the message's expiry time as though we sent it - now the
// message should be sendable after one round-trip // message should be sendable after one round-trip
db.updateExpiryTime(txn, contactId, messageId, 1000); db.updateExpiryTime(txn, contactId, messageId, 1000);