Add missed file updates in refactor

This commit is contained in:
Devon Hudson 2023-01-19 14:33:30 -07:00
parent 3f10d42c1b
commit 491ee90d49
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628

View file

@ -84,8 +84,8 @@ func (oq *destinationQueue) sendEvent(event *gomatrixserverlib.HeaderedEvent, db
oq.pendingMutex.Lock() oq.pendingMutex.Lock()
if len(oq.pendingPDUs) < maxPDUsInMemory { if len(oq.pendingPDUs) < maxPDUsInMemory {
oq.pendingPDUs = append(oq.pendingPDUs, &queuedPDU{ oq.pendingPDUs = append(oq.pendingPDUs, &queuedPDU{
pdu: event, pdu: event,
eventReceipt: dbReceipt, dbReceipt: dbReceipt,
}) })
} else { } else {
oq.overflowed.Store(true) oq.overflowed.Store(true)
@ -115,8 +115,8 @@ func (oq *destinationQueue) sendEDU(event *gomatrixserverlib.EDU, dbReceipt *rec
oq.pendingMutex.Lock() oq.pendingMutex.Lock()
if len(oq.pendingEDUs) < maxEDUsInMemory { if len(oq.pendingEDUs) < maxEDUsInMemory {
oq.pendingEDUs = append(oq.pendingEDUs, &queuedEDU{ oq.pendingEDUs = append(oq.pendingEDUs, &queuedEDU{
edu: event, edu: event,
eventReceipt: dbReceipt, dbReceipt: dbReceipt,
}) })
} else { } else {
oq.overflowed.Store(true) oq.overflowed.Store(true)
@ -210,10 +210,10 @@ func (oq *destinationQueue) getPendingFromDatabase() {
gotPDUs := map[string]struct{}{} gotPDUs := map[string]struct{}{}
gotEDUs := map[string]struct{}{} gotEDUs := map[string]struct{}{}
for _, pdu := range oq.pendingPDUs { for _, pdu := range oq.pendingPDUs {
gotPDUs[pdu.eventReceipt.String()] = struct{}{} gotPDUs[pdu.dbReceipt.String()] = struct{}{}
} }
for _, edu := range oq.pendingEDUs { for _, edu := range oq.pendingEDUs {
gotEDUs[edu.eventReceipt.String()] = struct{}{} gotEDUs[edu.dbReceipt.String()] = struct{}{}
} }
overflowed := false overflowed := false
@ -518,7 +518,7 @@ func (oq *destinationQueue) createTransaction(
// Append the JSON of the event, since this is a json.RawMessage type in the // Append the JSON of the event, since this is a json.RawMessage type in the
// gomatrixserverlib.Transaction struct // gomatrixserverlib.Transaction struct
t.PDUs = append(t.PDUs, pdu.pdu.JSON()) t.PDUs = append(t.PDUs, pdu.pdu.JSON())
pduReceipts = append(pduReceipts, pdu.eventReceipt) pduReceipts = append(pduReceipts, pdu.dbReceipt)
} }
// Do the same for pending EDUS in the queue. // Do the same for pending EDUS in the queue.
@ -528,7 +528,7 @@ func (oq *destinationQueue) createTransaction(
continue continue
} }
t.EDUs = append(t.EDUs, *edu.edu) t.EDUs = append(t.EDUs, *edu.edu)
eduReceipts = append(eduReceipts, edu.eventReceipt) eduReceipts = append(eduReceipts, edu.dbReceipt)
} }
return t, pduReceipts, eduReceipts return t, pduReceipts, eduReceipts