mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-21 05:43:09 -06:00
Debug logging
This commit is contained in:
parent
bab00192c2
commit
ebaa0cf5d4
|
|
@ -107,7 +107,7 @@ func (oq *destinationQueue) sendEvent(nid int64) {
|
|||
oq.destination, // the destination server name
|
||||
[]int64{nid}, // NID from federationsender_queue_json table
|
||||
); err != nil {
|
||||
log.WithError(err).Errorf("failed to associate PDU with ID %d with destination %q", oq.destination)
|
||||
log.WithError(err).Errorf("failed to associate PDU NID %d with destination %q", nid, oq.destination)
|
||||
return
|
||||
}
|
||||
// We've successfully added a PDU to the transaction so increase
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ func (s *queueJSONStatements) deleteQueueJSON(
|
|||
return err
|
||||
}
|
||||
|
||||
func (s *queueJSONStatements) selectJSON(
|
||||
func (s *queueJSONStatements) selectQueueJSON(
|
||||
ctx context.Context, txn *sql.Tx, jsonNIDs []int64,
|
||||
) (map[int64][]byte, error) {
|
||||
blobs := map[int64][]byte{}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ func (d *Database) GetNextTransactionPDUs(
|
|||
return "", nil, fmt.Errorf("d.selectQueuePDUs: %w", err)
|
||||
}
|
||||
|
||||
blobs, err := d.selectJSON(ctx, nil, nids)
|
||||
blobs, err := d.selectQueueJSON(ctx, nil, nids)
|
||||
if err != nil {
|
||||
return "", nil, fmt.Errorf("d.selectJSON: %w", err)
|
||||
}
|
||||
|
|
@ -216,11 +216,15 @@ func (d *Database) CleanTransactionPDUs(
|
|||
serverName gomatrixserverlib.ServerName,
|
||||
transactionID gomatrixserverlib.TransactionID,
|
||||
) error {
|
||||
fmt.Println("Cleaning up after transaction", transactionID)
|
||||
|
||||
nids, err := d.selectQueuePDUs(ctx, nil, serverName, transactionID, 50)
|
||||
if err != nil {
|
||||
return fmt.Errorf("d.selectQueuePDUs: %w", err)
|
||||
}
|
||||
|
||||
fmt.Println("Transaction", transactionID, "has", len(nids), "NIDs")
|
||||
|
||||
if err = d.deleteQueueTransaction(ctx, nil, serverName, transactionID); err != nil {
|
||||
return fmt.Errorf("d.deleteQueueTransaction: %w", err)
|
||||
}
|
||||
|
|
@ -237,6 +241,9 @@ func (d *Database) CleanTransactionPDUs(
|
|||
}
|
||||
}
|
||||
|
||||
fmt.Println("There are", len(deleteNIDs), "unreferenced NIDs ready for deletion")
|
||||
fmt.Println("There are", len(nids)-len(deleteNIDs), "NIDs still referenced")
|
||||
|
||||
if len(deleteNIDs) > 0 {
|
||||
if err = d.deleteQueueJSON(ctx, nil, deleteNIDs); err != nil {
|
||||
return fmt.Errorf("d.deleteQueueJSON: %w", err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue