aboutsummaryrefslogtreecommitdiff
path: root/federationsender/storage/postgres/queue_pdus_table.go
diff options
context:
space:
mode:
Diffstat (limited to 'federationsender/storage/postgres/queue_pdus_table.go')
-rw-r--r--federationsender/storage/postgres/queue_pdus_table.go37
1 files changed, 7 insertions, 30 deletions
diff --git a/federationsender/storage/postgres/queue_pdus_table.go b/federationsender/storage/postgres/queue_pdus_table.go
index 95a3b9ee..f9a47748 100644
--- a/federationsender/storage/postgres/queue_pdus_table.go
+++ b/federationsender/storage/postgres/queue_pdus_table.go
@@ -45,16 +45,10 @@ const insertQueuePDUSQL = "" +
const deleteQueuePDUSQL = "" +
"DELETE FROM federationsender_queue_pdus WHERE server_name = $1 AND json_nid = ANY($2)"
-const selectQueuePDUNextTransactionIDSQL = "" +
- "SELECT transaction_id FROM federationsender_queue_pdus" +
- " WHERE server_name = $1" +
- " ORDER BY transaction_id ASC" +
- " LIMIT 1"
-
-const selectQueuePDUsByTransactionSQL = "" +
+const selectQueuePDUsSQL = "" +
"SELECT json_nid FROM federationsender_queue_pdus" +
- " WHERE server_name = $1 AND transaction_id = $2" +
- " LIMIT $3"
+ " WHERE server_name = $1" +
+ " LIMIT $2"
const selectQueuePDUReferenceJSONCountSQL = "" +
"SELECT COUNT(*) FROM federationsender_queue_pdus" +
@@ -71,8 +65,7 @@ type queuePDUsStatements struct {
db *sql.DB
insertQueuePDUStmt *sql.Stmt
deleteQueuePDUsStmt *sql.Stmt
- selectQueuePDUNextTransactionIDStmt *sql.Stmt
- selectQueuePDUsByTransactionStmt *sql.Stmt
+ selectQueuePDUsStmt *sql.Stmt
selectQueuePDUReferenceJSONCountStmt *sql.Stmt
selectQueuePDUsCountStmt *sql.Stmt
selectQueuePDUServerNamesStmt *sql.Stmt
@@ -92,10 +85,7 @@ func NewPostgresQueuePDUsTable(db *sql.DB) (s *queuePDUsStatements, err error) {
if s.deleteQueuePDUsStmt, err = s.db.Prepare(deleteQueuePDUSQL); err != nil {
return
}
- if s.selectQueuePDUNextTransactionIDStmt, err = s.db.Prepare(selectQueuePDUNextTransactionIDSQL); err != nil {
- return
- }
- if s.selectQueuePDUsByTransactionStmt, err = s.db.Prepare(selectQueuePDUsByTransactionSQL); err != nil {
+ if s.selectQueuePDUsStmt, err = s.db.Prepare(selectQueuePDUsSQL); err != nil {
return
}
if s.selectQueuePDUReferenceJSONCountStmt, err = s.db.Prepare(selectQueuePDUReferenceJSONCountSQL); err != nil {
@@ -137,18 +127,6 @@ func (s *queuePDUsStatements) DeleteQueuePDUs(
return err
}
-func (s *queuePDUsStatements) SelectQueuePDUNextTransactionID(
- ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName,
-) (gomatrixserverlib.TransactionID, error) {
- var transactionID gomatrixserverlib.TransactionID
- stmt := sqlutil.TxStmt(txn, s.selectQueuePDUNextTransactionIDStmt)
- err := stmt.QueryRowContext(ctx, serverName).Scan(&transactionID)
- if err == sql.ErrNoRows {
- return "", nil
- }
- return transactionID, err
-}
-
func (s *queuePDUsStatements) SelectQueuePDUReferenceJSONCount(
ctx context.Context, txn *sql.Tx, jsonNID int64,
) (int64, error) {
@@ -182,11 +160,10 @@ func (s *queuePDUsStatements) SelectQueuePDUCount(
func (s *queuePDUsStatements) SelectQueuePDUs(
ctx context.Context, txn *sql.Tx,
serverName gomatrixserverlib.ServerName,
- transactionID gomatrixserverlib.TransactionID,
limit int,
) ([]int64, error) {
- stmt := sqlutil.TxStmt(txn, s.selectQueuePDUsByTransactionStmt)
- rows, err := stmt.QueryContext(ctx, serverName, transactionID, limit)
+ stmt := sqlutil.TxStmt(txn, s.selectQueuePDUsStmt)
+ rows, err := stmt.QueryContext(ctx, serverName, limit)
if err != nil {
return nil, err
}