Send newest messages first.

This removes the need to send a start time for each subscription; new
subscribers will receive old messages if and only if there's bandwidth.
This commit is contained in:
akwizgran
2013-01-28 23:24:35 +00:00
parent 2ebbe0eb2a
commit 42dd7f238c

View File

@@ -1363,8 +1363,7 @@ abstract class JdbcDatabase implements Database<Connection> {
+ " JOIN statuses AS s"
+ " ON m.messageId = s.messageId"
+ " WHERE m.contactId = ? AND status = ?"
+ " ORDER BY timestamp"
+ " LIMIT ?";
+ " ORDER BY timestamp DESC LIMIT ?";
ps = txn.prepareStatement(sql);
ps.setInt(1, c.getInt());
ps.setShort(2, (short) Status.NEW.ordinal());
@@ -1392,8 +1391,7 @@ abstract class JdbcDatabase implements Database<Connection> {
+ " AND timestamp >= expiry"
+ " AND status = ?"
+ " AND sendability > ZERO()"
+ " ORDER BY timestamp"
+ " LIMIT ?";
+ " ORDER BY timestamp DESC LIMIT ?";
ps = txn.prepareStatement(sql);
ps.setInt(1, c.getInt());
ps.setShort(2, (short) Status.NEW.ordinal());
@@ -1621,7 +1619,7 @@ abstract class JdbcDatabase implements Database<Connection> {
+ " JOIN statuses AS s"
+ " ON m.messageId = s.messageId"
+ " WHERE m.contactId = ? AND status = ?"
+ " ORDER BY timestamp";
+ " ORDER BY timestamp DESC";
ps = txn.prepareStatement(sql);
ps.setInt(1, c.getInt());
ps.setShort(2, (short) Status.NEW.ordinal());
@@ -1653,7 +1651,7 @@ abstract class JdbcDatabase implements Database<Connection> {
+ " AND timestamp >= expiry"
+ " AND status = ?"
+ " AND sendability > ZERO()"
+ " ORDER BY timestamp";
+ " ORDER BY timestamp DESC";
ps = txn.prepareStatement(sql);
ps.setInt(1, c.getInt());
ps.setShort(2, (short) Status.NEW.ordinal());