mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-22 13:33:09 -06:00
Remove unused code, fix linter issues
This commit is contained in:
parent
59c39efdda
commit
d9cfc1720a
|
|
@ -221,28 +221,6 @@ func (d *fakeDatabase) CleanEDUs(ctx context.Context, serverName gomatrixserverl
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *fakeDatabase) GetPendingPDUCount(ctx context.Context, serverName gomatrixserverlib.ServerName) (int64, error) {
|
|
||||||
d.dbMutex.Lock()
|
|
||||||
defer d.dbMutex.Unlock()
|
|
||||||
|
|
||||||
var count int64
|
|
||||||
if pdus, ok := d.associatedPDUs[serverName]; ok {
|
|
||||||
count = int64(len(pdus))
|
|
||||||
}
|
|
||||||
return count, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *fakeDatabase) GetPendingEDUCount(ctx context.Context, serverName gomatrixserverlib.ServerName) (int64, error) {
|
|
||||||
d.dbMutex.Lock()
|
|
||||||
defer d.dbMutex.Unlock()
|
|
||||||
|
|
||||||
var count int64
|
|
||||||
if edus, ok := d.associatedEDUs[serverName]; ok {
|
|
||||||
count = int64(len(edus))
|
|
||||||
}
|
|
||||||
return count, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *fakeDatabase) GetPendingPDUServerNames(ctx context.Context) ([]gomatrixserverlib.ServerName, error) {
|
func (d *fakeDatabase) GetPendingPDUServerNames(ctx context.Context) ([]gomatrixserverlib.ServerName, error) {
|
||||||
d.dbMutex.Lock()
|
d.dbMutex.Lock()
|
||||||
defer d.dbMutex.Unlock()
|
defer d.dbMutex.Unlock()
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,6 @@ type Database interface {
|
||||||
CleanPDUs(ctx context.Context, serverName gomatrixserverlib.ServerName, receipts []*shared.Receipt) error
|
CleanPDUs(ctx context.Context, serverName gomatrixserverlib.ServerName, receipts []*shared.Receipt) error
|
||||||
CleanEDUs(ctx context.Context, serverName gomatrixserverlib.ServerName, receipts []*shared.Receipt) error
|
CleanEDUs(ctx context.Context, serverName gomatrixserverlib.ServerName, receipts []*shared.Receipt) error
|
||||||
|
|
||||||
GetPendingPDUCount(ctx context.Context, serverName gomatrixserverlib.ServerName) (int64, error)
|
|
||||||
GetPendingEDUCount(ctx context.Context, serverName gomatrixserverlib.ServerName) (int64, error)
|
|
||||||
|
|
||||||
GetPendingPDUServerNames(ctx context.Context) ([]gomatrixserverlib.ServerName, error)
|
GetPendingPDUServerNames(ctx context.Context) ([]gomatrixserverlib.ServerName, error)
|
||||||
GetPendingEDUServerNames(ctx context.Context) ([]gomatrixserverlib.ServerName, error)
|
GetPendingEDUServerNames(ctx context.Context) ([]gomatrixserverlib.ServerName, error)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,6 @@ const selectQueueEDUReferenceJSONCountSQL = "" +
|
||||||
"SELECT COUNT(*) FROM federationsender_queue_edus" +
|
"SELECT COUNT(*) FROM federationsender_queue_edus" +
|
||||||
" WHERE json_nid = $1"
|
" WHERE json_nid = $1"
|
||||||
|
|
||||||
const selectQueueEDUCountSQL = "" +
|
|
||||||
"SELECT COUNT(*) FROM federationsender_queue_edus" +
|
|
||||||
" WHERE server_name = $1"
|
|
||||||
|
|
||||||
const selectQueueServerNamesSQL = "" +
|
const selectQueueServerNamesSQL = "" +
|
||||||
"SELECT DISTINCT server_name FROM federationsender_queue_edus"
|
"SELECT DISTINCT server_name FROM federationsender_queue_edus"
|
||||||
|
|
||||||
|
|
@ -81,7 +77,6 @@ type queueEDUsStatements struct {
|
||||||
deleteQueueEDUStmt *sql.Stmt
|
deleteQueueEDUStmt *sql.Stmt
|
||||||
selectQueueEDUStmt *sql.Stmt
|
selectQueueEDUStmt *sql.Stmt
|
||||||
selectQueueEDUReferenceJSONCountStmt *sql.Stmt
|
selectQueueEDUReferenceJSONCountStmt *sql.Stmt
|
||||||
selectQueueEDUCountStmt *sql.Stmt
|
|
||||||
selectQueueEDUServerNamesStmt *sql.Stmt
|
selectQueueEDUServerNamesStmt *sql.Stmt
|
||||||
selectExpiredEDUsStmt *sql.Stmt
|
selectExpiredEDUsStmt *sql.Stmt
|
||||||
deleteExpiredEDUsStmt *sql.Stmt
|
deleteExpiredEDUsStmt *sql.Stmt
|
||||||
|
|
@ -116,7 +111,6 @@ func (s *queueEDUsStatements) Prepare() error {
|
||||||
{&s.deleteQueueEDUStmt, deleteQueueEDUSQL},
|
{&s.deleteQueueEDUStmt, deleteQueueEDUSQL},
|
||||||
{&s.selectQueueEDUStmt, selectQueueEDUSQL},
|
{&s.selectQueueEDUStmt, selectQueueEDUSQL},
|
||||||
{&s.selectQueueEDUReferenceJSONCountStmt, selectQueueEDUReferenceJSONCountSQL},
|
{&s.selectQueueEDUReferenceJSONCountStmt, selectQueueEDUReferenceJSONCountSQL},
|
||||||
{&s.selectQueueEDUCountStmt, selectQueueEDUCountSQL},
|
|
||||||
{&s.selectQueueEDUServerNamesStmt, selectQueueServerNamesSQL},
|
{&s.selectQueueEDUServerNamesStmt, selectQueueServerNamesSQL},
|
||||||
{&s.selectExpiredEDUsStmt, selectExpiredEDUsSQL},
|
{&s.selectExpiredEDUsStmt, selectExpiredEDUsSQL},
|
||||||
{&s.deleteExpiredEDUsStmt, deleteExpiredEDUsSQL},
|
{&s.deleteExpiredEDUsStmt, deleteExpiredEDUsSQL},
|
||||||
|
|
@ -186,21 +180,6 @@ func (s *queueEDUsStatements) SelectQueueEDUReferenceJSONCount(
|
||||||
return count, err
|
return count, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *queueEDUsStatements) SelectQueueEDUCount(
|
|
||||||
ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName,
|
|
||||||
) (int64, error) {
|
|
||||||
var count int64
|
|
||||||
stmt := sqlutil.TxStmt(txn, s.selectQueueEDUCountStmt)
|
|
||||||
err := stmt.QueryRowContext(ctx, serverName).Scan(&count)
|
|
||||||
if err == sql.ErrNoRows {
|
|
||||||
// It's acceptable for there to be no rows referencing a given
|
|
||||||
// JSON NID but it's not an error condition. Just return as if
|
|
||||||
// there's a zero count.
|
|
||||||
return 0, nil
|
|
||||||
}
|
|
||||||
return count, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *queueEDUsStatements) SelectQueueEDUServerNames(
|
func (s *queueEDUsStatements) SelectQueueEDUServerNames(
|
||||||
ctx context.Context, txn *sql.Tx,
|
ctx context.Context, txn *sql.Tx,
|
||||||
) ([]gomatrixserverlib.ServerName, error) {
|
) ([]gomatrixserverlib.ServerName, error) {
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,6 @@ const selectQueuePDUReferenceJSONCountSQL = "" +
|
||||||
"SELECT COUNT(*) FROM federationsender_queue_pdus" +
|
"SELECT COUNT(*) FROM federationsender_queue_pdus" +
|
||||||
" WHERE json_nid = $1"
|
" WHERE json_nid = $1"
|
||||||
|
|
||||||
const selectQueuePDUsCountSQL = "" +
|
|
||||||
"SELECT COUNT(*) FROM federationsender_queue_pdus" +
|
|
||||||
" WHERE server_name = $1"
|
|
||||||
|
|
||||||
const selectQueuePDUServerNamesSQL = "" +
|
const selectQueuePDUServerNamesSQL = "" +
|
||||||
"SELECT DISTINCT server_name FROM federationsender_queue_pdus"
|
"SELECT DISTINCT server_name FROM federationsender_queue_pdus"
|
||||||
|
|
||||||
|
|
@ -71,7 +67,6 @@ type queuePDUsStatements struct {
|
||||||
deleteQueuePDUsStmt *sql.Stmt
|
deleteQueuePDUsStmt *sql.Stmt
|
||||||
selectQueuePDUsStmt *sql.Stmt
|
selectQueuePDUsStmt *sql.Stmt
|
||||||
selectQueuePDUReferenceJSONCountStmt *sql.Stmt
|
selectQueuePDUReferenceJSONCountStmt *sql.Stmt
|
||||||
selectQueuePDUsCountStmt *sql.Stmt
|
|
||||||
selectQueuePDUServerNamesStmt *sql.Stmt
|
selectQueuePDUServerNamesStmt *sql.Stmt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,9 +90,6 @@ func NewPostgresQueuePDUsTable(db *sql.DB) (s *queuePDUsStatements, err error) {
|
||||||
if s.selectQueuePDUReferenceJSONCountStmt, err = s.db.Prepare(selectQueuePDUReferenceJSONCountSQL); err != nil {
|
if s.selectQueuePDUReferenceJSONCountStmt, err = s.db.Prepare(selectQueuePDUReferenceJSONCountSQL); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if s.selectQueuePDUsCountStmt, err = s.db.Prepare(selectQueuePDUsCountSQL); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if s.selectQueuePDUServerNamesStmt, err = s.db.Prepare(selectQueuePDUServerNamesSQL); err != nil {
|
if s.selectQueuePDUServerNamesStmt, err = s.db.Prepare(selectQueuePDUServerNamesSQL); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -146,21 +138,6 @@ func (s *queuePDUsStatements) SelectQueuePDUReferenceJSONCount(
|
||||||
return count, err
|
return count, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *queuePDUsStatements) SelectQueuePDUCount(
|
|
||||||
ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName,
|
|
||||||
) (int64, error) {
|
|
||||||
var count int64
|
|
||||||
stmt := sqlutil.TxStmt(txn, s.selectQueuePDUsCountStmt)
|
|
||||||
err := stmt.QueryRowContext(ctx, serverName).Scan(&count)
|
|
||||||
if err == sql.ErrNoRows {
|
|
||||||
// It's acceptable for there to be no rows referencing a given
|
|
||||||
// JSON NID but it's not an error condition. Just return as if
|
|
||||||
// there's a zero count.
|
|
||||||
return 0, nil
|
|
||||||
}
|
|
||||||
return count, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *queuePDUsStatements) SelectQueuePDUs(
|
func (s *queuePDUsStatements) SelectQueuePDUs(
|
||||||
ctx context.Context, txn *sql.Tx,
|
ctx context.Context, txn *sql.Tx,
|
||||||
serverName gomatrixserverlib.ServerName,
|
serverName gomatrixserverlib.ServerName,
|
||||||
|
|
|
||||||
|
|
@ -162,15 +162,6 @@ func (d *Database) CleanEDUs(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPendingEDUCount returns the number of EDUs waiting to be
|
|
||||||
// sent for a given servername.
|
|
||||||
func (d *Database) GetPendingEDUCount(
|
|
||||||
ctx context.Context,
|
|
||||||
serverName gomatrixserverlib.ServerName,
|
|
||||||
) (int64, error) {
|
|
||||||
return d.FederationQueueEDUs.SelectQueueEDUCount(ctx, nil, serverName)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPendingServerNames returns the server names that have EDUs
|
// GetPendingServerNames returns the server names that have EDUs
|
||||||
// waiting to be sent.
|
// waiting to be sent.
|
||||||
func (d *Database) GetPendingEDUServerNames(
|
func (d *Database) GetPendingEDUServerNames(
|
||||||
|
|
|
||||||
|
|
@ -141,15 +141,6 @@ func (d *Database) CleanPDUs(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPendingPDUCount returns the number of PDUs waiting to be
|
|
||||||
// sent for a given servername.
|
|
||||||
func (d *Database) GetPendingPDUCount(
|
|
||||||
ctx context.Context,
|
|
||||||
serverName gomatrixserverlib.ServerName,
|
|
||||||
) (int64, error) {
|
|
||||||
return d.FederationQueuePDUs.SelectQueuePDUCount(ctx, nil, serverName)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPendingServerNames returns the server names that have PDUs
|
// GetPendingServerNames returns the server names that have PDUs
|
||||||
// waiting to be sent.
|
// waiting to be sent.
|
||||||
func (d *Database) GetPendingPDUServerNames(
|
func (d *Database) GetPendingPDUServerNames(
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,6 @@ const selectQueueEDUReferenceJSONCountSQL = "" +
|
||||||
"SELECT COUNT(*) FROM federationsender_queue_edus" +
|
"SELECT COUNT(*) FROM federationsender_queue_edus" +
|
||||||
" WHERE json_nid = $1"
|
" WHERE json_nid = $1"
|
||||||
|
|
||||||
const selectQueueEDUCountSQL = "" +
|
|
||||||
"SELECT COUNT(*) FROM federationsender_queue_edus" +
|
|
||||||
" WHERE server_name = $1"
|
|
||||||
|
|
||||||
const selectQueueServerNamesSQL = "" +
|
const selectQueueServerNamesSQL = "" +
|
||||||
"SELECT DISTINCT server_name FROM federationsender_queue_edus"
|
"SELECT DISTINCT server_name FROM federationsender_queue_edus"
|
||||||
|
|
||||||
|
|
@ -82,7 +78,6 @@ type queueEDUsStatements struct {
|
||||||
// deleteQueueEDUStmt *sql.Stmt - prepared at runtime due to variadic
|
// deleteQueueEDUStmt *sql.Stmt - prepared at runtime due to variadic
|
||||||
selectQueueEDUStmt *sql.Stmt
|
selectQueueEDUStmt *sql.Stmt
|
||||||
selectQueueEDUReferenceJSONCountStmt *sql.Stmt
|
selectQueueEDUReferenceJSONCountStmt *sql.Stmt
|
||||||
selectQueueEDUCountStmt *sql.Stmt
|
|
||||||
selectQueueEDUServerNamesStmt *sql.Stmt
|
selectQueueEDUServerNamesStmt *sql.Stmt
|
||||||
selectExpiredEDUsStmt *sql.Stmt
|
selectExpiredEDUsStmt *sql.Stmt
|
||||||
deleteExpiredEDUsStmt *sql.Stmt
|
deleteExpiredEDUsStmt *sql.Stmt
|
||||||
|
|
@ -116,7 +111,6 @@ func (s *queueEDUsStatements) Prepare() error {
|
||||||
{&s.insertQueueEDUStmt, insertQueueEDUSQL},
|
{&s.insertQueueEDUStmt, insertQueueEDUSQL},
|
||||||
{&s.selectQueueEDUStmt, selectQueueEDUSQL},
|
{&s.selectQueueEDUStmt, selectQueueEDUSQL},
|
||||||
{&s.selectQueueEDUReferenceJSONCountStmt, selectQueueEDUReferenceJSONCountSQL},
|
{&s.selectQueueEDUReferenceJSONCountStmt, selectQueueEDUReferenceJSONCountSQL},
|
||||||
{&s.selectQueueEDUCountStmt, selectQueueEDUCountSQL},
|
|
||||||
{&s.selectQueueEDUServerNamesStmt, selectQueueServerNamesSQL},
|
{&s.selectQueueEDUServerNamesStmt, selectQueueServerNamesSQL},
|
||||||
{&s.selectExpiredEDUsStmt, selectExpiredEDUsSQL},
|
{&s.selectExpiredEDUsStmt, selectExpiredEDUsSQL},
|
||||||
{&s.deleteExpiredEDUsStmt, deleteExpiredEDUsSQL},
|
{&s.deleteExpiredEDUsStmt, deleteExpiredEDUsSQL},
|
||||||
|
|
@ -198,21 +192,6 @@ func (s *queueEDUsStatements) SelectQueueEDUReferenceJSONCount(
|
||||||
return count, err
|
return count, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *queueEDUsStatements) SelectQueueEDUCount(
|
|
||||||
ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName,
|
|
||||||
) (int64, error) {
|
|
||||||
var count int64
|
|
||||||
stmt := sqlutil.TxStmt(txn, s.selectQueueEDUCountStmt)
|
|
||||||
err := stmt.QueryRowContext(ctx, serverName).Scan(&count)
|
|
||||||
if err == sql.ErrNoRows {
|
|
||||||
// It's acceptable for there to be no rows referencing a given
|
|
||||||
// JSON NID but it's not an error condition. Just return as if
|
|
||||||
// there's a zero count.
|
|
||||||
return 0, nil
|
|
||||||
}
|
|
||||||
return count, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *queueEDUsStatements) SelectQueueEDUServerNames(
|
func (s *queueEDUsStatements) SelectQueueEDUServerNames(
|
||||||
ctx context.Context, txn *sql.Tx,
|
ctx context.Context, txn *sql.Tx,
|
||||||
) ([]gomatrixserverlib.ServerName, error) {
|
) ([]gomatrixserverlib.ServerName, error) {
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,6 @@ const selectQueuePDUsReferenceJSONCountSQL = "" +
|
||||||
"SELECT COUNT(*) FROM federationsender_queue_pdus" +
|
"SELECT COUNT(*) FROM federationsender_queue_pdus" +
|
||||||
" WHERE json_nid = $1"
|
" WHERE json_nid = $1"
|
||||||
|
|
||||||
const selectQueuePDUsCountSQL = "" +
|
|
||||||
"SELECT COUNT(*) FROM federationsender_queue_pdus" +
|
|
||||||
" WHERE server_name = $1"
|
|
||||||
|
|
||||||
const selectQueuePDUsServerNamesSQL = "" +
|
const selectQueuePDUsServerNamesSQL = "" +
|
||||||
"SELECT DISTINCT server_name FROM federationsender_queue_pdus"
|
"SELECT DISTINCT server_name FROM federationsender_queue_pdus"
|
||||||
|
|
||||||
|
|
@ -79,7 +75,6 @@ type queuePDUsStatements struct {
|
||||||
selectQueueNextTransactionIDStmt *sql.Stmt
|
selectQueueNextTransactionIDStmt *sql.Stmt
|
||||||
selectQueuePDUsStmt *sql.Stmt
|
selectQueuePDUsStmt *sql.Stmt
|
||||||
selectQueueReferenceJSONCountStmt *sql.Stmt
|
selectQueueReferenceJSONCountStmt *sql.Stmt
|
||||||
selectQueuePDUsCountStmt *sql.Stmt
|
|
||||||
selectQueueServerNamesStmt *sql.Stmt
|
selectQueueServerNamesStmt *sql.Stmt
|
||||||
// deleteQueuePDUsStmt *sql.Stmt - prepared at runtime due to variadic
|
// deleteQueuePDUsStmt *sql.Stmt - prepared at runtime due to variadic
|
||||||
}
|
}
|
||||||
|
|
@ -107,9 +102,6 @@ func NewSQLiteQueuePDUsTable(db *sql.DB) (s *queuePDUsStatements, err error) {
|
||||||
if s.selectQueueReferenceJSONCountStmt, err = db.Prepare(selectQueuePDUsReferenceJSONCountSQL); err != nil {
|
if s.selectQueueReferenceJSONCountStmt, err = db.Prepare(selectQueuePDUsReferenceJSONCountSQL); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if s.selectQueuePDUsCountStmt, err = db.Prepare(selectQueuePDUsCountSQL); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if s.selectQueueServerNamesStmt, err = db.Prepare(selectQueuePDUsServerNamesSQL); err != nil {
|
if s.selectQueueServerNamesStmt, err = db.Prepare(selectQueuePDUsServerNamesSQL); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -179,21 +171,6 @@ func (s *queuePDUsStatements) SelectQueuePDUReferenceJSONCount(
|
||||||
return count, err
|
return count, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *queuePDUsStatements) SelectQueuePDUCount(
|
|
||||||
ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName,
|
|
||||||
) (int64, error) {
|
|
||||||
var count int64
|
|
||||||
stmt := sqlutil.TxStmt(txn, s.selectQueuePDUsCountStmt)
|
|
||||||
err := stmt.QueryRowContext(ctx, serverName).Scan(&count)
|
|
||||||
if err == sql.ErrNoRows {
|
|
||||||
// It's acceptable for there to be no rows referencing a given
|
|
||||||
// JSON NID but it's not an error condition. Just return as if
|
|
||||||
// there's a zero count.
|
|
||||||
return 0, nil
|
|
||||||
}
|
|
||||||
return count, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *queuePDUsStatements) SelectQueuePDUs(
|
func (s *queuePDUsStatements) SelectQueuePDUs(
|
||||||
ctx context.Context, txn *sql.Tx,
|
ctx context.Context, txn *sql.Tx,
|
||||||
serverName gomatrixserverlib.ServerName,
|
serverName gomatrixserverlib.ServerName,
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ func TestOutboundPeeking(t *testing.T) {
|
||||||
t.Fatalf("unexpected outbound peek renewal interval: %d, want %d", outboundPeek1.RenewalInterval, renewalInterval)
|
t.Fatalf("unexpected outbound peek renewal interval: %d, want %d", outboundPeek1.RenewalInterval, renewalInterval)
|
||||||
}
|
}
|
||||||
// Renew the peek
|
// Renew the peek
|
||||||
if err := db.RenewOutboundPeek(ctx, serverName, room.ID, peekID, 2000); err != nil {
|
if err = db.RenewOutboundPeek(ctx, serverName, room.ID, peekID, 2000); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,7 +143,7 @@ func TestOutboundPeeking(t *testing.T) {
|
||||||
peekIDs := []string{peekID}
|
peekIDs := []string{peekID}
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
peekID = util.RandomString(8)
|
peekID = util.RandomString(8)
|
||||||
if err := db.AddOutboundPeek(ctx, serverName, room.ID, peekID, 1000); err != nil {
|
if err = db.AddOutboundPeek(ctx, serverName, room.ID, peekID, 1000); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
peekIDs = append(peekIDs, peekID)
|
peekIDs = append(peekIDs, peekID)
|
||||||
|
|
@ -202,7 +202,7 @@ func TestInboundPeeking(t *testing.T) {
|
||||||
t.Fatalf("unexpected inbound peek renewal interval: %d, want %d", inboundPeek1.RenewalInterval, renewalInterval)
|
t.Fatalf("unexpected inbound peek renewal interval: %d, want %d", inboundPeek1.RenewalInterval, renewalInterval)
|
||||||
}
|
}
|
||||||
// Renew the peek
|
// Renew the peek
|
||||||
if err := db.RenewInboundPeek(ctx, serverName, room.ID, peekID, 2000); err != nil {
|
if err = db.RenewInboundPeek(ctx, serverName, room.ID, peekID, 2000); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -225,7 +225,7 @@ func TestInboundPeeking(t *testing.T) {
|
||||||
peekIDs := []string{peekID}
|
peekIDs := []string{peekID}
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
peekID = util.RandomString(8)
|
peekID = util.RandomString(8)
|
||||||
if err := db.AddInboundPeek(ctx, serverName, room.ID, peekID, 1000); err != nil {
|
if err = db.AddInboundPeek(ctx, serverName, room.ID, peekID, 1000); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
peekIDs = append(peekIDs, peekID)
|
peekIDs = append(peekIDs, peekID)
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ func TestInboundPeeksTable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renew the peek
|
// Renew the peek
|
||||||
if err := tab.RenewInboundPeek(ctx, nil, serverName, room.ID, peekID, 2000); err != nil {
|
if err = tab.RenewInboundPeek(ctx, nil, serverName, room.ID, peekID, 2000); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ func TestInboundPeeksTable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete the peek
|
// delete the peek
|
||||||
if err := tab.DeleteInboundPeek(ctx, nil, serverName, room.ID, peekID); err != nil {
|
if err = tab.DeleteInboundPeek(ctx, nil, serverName, room.ID, peekID); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ func TestInboundPeeksTable(t *testing.T) {
|
||||||
var peekIDs []string
|
var peekIDs []string
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
peekID = util.RandomString(8)
|
peekID = util.RandomString(8)
|
||||||
if err := tab.InsertInboundPeek(ctx, nil, serverName, room.ID, peekID, 1000); err != nil {
|
if err = tab.InsertInboundPeek(ctx, nil, serverName, room.ID, peekID, 1000); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
peekIDs = append(peekIDs, peekID)
|
peekIDs = append(peekIDs, peekID)
|
||||||
|
|
@ -131,7 +131,7 @@ func TestInboundPeeksTable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// And delete them again
|
// And delete them again
|
||||||
if err := tab.DeleteInboundPeeks(ctx, nil, room.ID); err != nil {
|
if err = tab.DeleteInboundPeeks(ctx, nil, room.ID); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ type FederationQueuePDUs interface {
|
||||||
InsertQueuePDU(ctx context.Context, txn *sql.Tx, transactionID gomatrixserverlib.TransactionID, serverName gomatrixserverlib.ServerName, nid int64) error
|
InsertQueuePDU(ctx context.Context, txn *sql.Tx, transactionID gomatrixserverlib.TransactionID, serverName gomatrixserverlib.ServerName, nid int64) error
|
||||||
DeleteQueuePDUs(ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName, jsonNIDs []int64) error
|
DeleteQueuePDUs(ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName, jsonNIDs []int64) error
|
||||||
SelectQueuePDUReferenceJSONCount(ctx context.Context, txn *sql.Tx, jsonNID int64) (int64, error)
|
SelectQueuePDUReferenceJSONCount(ctx context.Context, txn *sql.Tx, jsonNID int64) (int64, error)
|
||||||
SelectQueuePDUCount(ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName) (int64, error)
|
|
||||||
SelectQueuePDUs(ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName, limit int) ([]int64, error)
|
SelectQueuePDUs(ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName, limit int) ([]int64, error)
|
||||||
SelectQueuePDUServerNames(ctx context.Context, txn *sql.Tx) ([]gomatrixserverlib.ServerName, error)
|
SelectQueuePDUServerNames(ctx context.Context, txn *sql.Tx) ([]gomatrixserverlib.ServerName, error)
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +37,6 @@ type FederationQueueEDUs interface {
|
||||||
DeleteQueueEDUs(ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName, jsonNIDs []int64) error
|
DeleteQueueEDUs(ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName, jsonNIDs []int64) error
|
||||||
SelectQueueEDUs(ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName, limit int) ([]int64, error)
|
SelectQueueEDUs(ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName, limit int) ([]int64, error)
|
||||||
SelectQueueEDUReferenceJSONCount(ctx context.Context, txn *sql.Tx, jsonNID int64) (int64, error)
|
SelectQueueEDUReferenceJSONCount(ctx context.Context, txn *sql.Tx, jsonNID int64) (int64, error)
|
||||||
SelectQueueEDUCount(ctx context.Context, txn *sql.Tx, serverName gomatrixserverlib.ServerName) (int64, error)
|
|
||||||
SelectQueueEDUServerNames(ctx context.Context, txn *sql.Tx) ([]gomatrixserverlib.ServerName, error)
|
SelectQueueEDUServerNames(ctx context.Context, txn *sql.Tx) ([]gomatrixserverlib.ServerName, error)
|
||||||
SelectExpiredEDUs(ctx context.Context, txn *sql.Tx, expiredBefore gomatrixserverlib.Timestamp) ([]int64, error)
|
SelectExpiredEDUs(ctx context.Context, txn *sql.Tx, expiredBefore gomatrixserverlib.Timestamp) ([]int64, error)
|
||||||
DeleteExpiredEDUs(ctx context.Context, txn *sql.Tx, expiredBefore gomatrixserverlib.Timestamp) error
|
DeleteExpiredEDUs(ctx context.Context, txn *sql.Tx, expiredBefore gomatrixserverlib.Timestamp) error
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ func TestOutboundPeeksTable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renew the peek
|
// Renew the peek
|
||||||
if err := tab.RenewOutboundPeek(ctx, nil, serverName, room.ID, peekID, 2000); err != nil {
|
if err = tab.RenewOutboundPeek(ctx, nil, serverName, room.ID, peekID, 2000); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ func TestOutboundPeeksTable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete the peek
|
// delete the peek
|
||||||
if err := tab.DeleteOutboundPeek(ctx, nil, serverName, room.ID, peekID); err != nil {
|
if err = tab.DeleteOutboundPeek(ctx, nil, serverName, room.ID, peekID); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ func TestOutboundPeeksTable(t *testing.T) {
|
||||||
var peekIDs []string
|
var peekIDs []string
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
peekID = util.RandomString(8)
|
peekID = util.RandomString(8)
|
||||||
if err := tab.InsertOutboundPeek(ctx, nil, serverName, room.ID, peekID, 1000); err != nil {
|
if err = tab.InsertOutboundPeek(ctx, nil, serverName, room.ID, peekID, 1000); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
peekIDs = append(peekIDs, peekID)
|
peekIDs = append(peekIDs, peekID)
|
||||||
|
|
@ -131,7 +131,7 @@ func TestOutboundPeeksTable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// And delete them again
|
// And delete them again
|
||||||
if err := tab.DeleteOutboundPeeks(ctx, nil, room.ID); err != nil {
|
if err = tab.DeleteOutboundPeeks(ctx, nil, room.ID); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue