mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-15 10:03:09 -06:00
move txnid to the end of the the funciton
This commit is contained in:
parent
8b43e24244
commit
3703fa92e2
|
|
@ -154,25 +154,23 @@ func (s *OutputRoomEventConsumer) onMessage(
|
||||||
|
|
||||||
txnID := ""
|
txnID := ""
|
||||||
// Try to get the message metadata, if we're able to, use the timestamp as the txnID
|
// Try to get the message metadata, if we're able to, use the timestamp as the txnID
|
||||||
if len(msgs) > 0 {
|
metadata, err := msgs[0].Metadata()
|
||||||
metadata, err := msgs[0].Metadata()
|
if err == nil {
|
||||||
if err == nil {
|
txnID = strconv.Itoa(int(metadata.Timestamp.UnixNano()))
|
||||||
txnID = strconv.Itoa(int(metadata.Timestamp.UnixNano()))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send event to any relevant application services. If we hit
|
// Send event to any relevant application services. If we hit
|
||||||
// an error here, return false, so that we negatively ack.
|
// an error here, return false, so that we negatively ack.
|
||||||
log.WithField("appservice", state.ID).Debugf("Appservice worker sending %d events(s) from roomserver", len(events))
|
log.WithField("appservice", state.ID).Debugf("Appservice worker sending %d events(s) from roomserver", len(events))
|
||||||
return s.sendEvents(txnID, ctx, state, events) == nil
|
return s.sendEvents(ctx, state, events, txnID) == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendEvents passes events to the appservice by using the transactions
|
// sendEvents passes events to the appservice by using the transactions
|
||||||
// endpoint. It will block for the backoff period if necessary.
|
// endpoint. It will block for the backoff period if necessary.
|
||||||
func (s *OutputRoomEventConsumer) sendEvents(
|
func (s *OutputRoomEventConsumer) sendEvents(
|
||||||
txnID string,
|
|
||||||
ctx context.Context, state *appserviceState,
|
ctx context.Context, state *appserviceState,
|
||||||
events []*gomatrixserverlib.HeaderedEvent,
|
events []*gomatrixserverlib.HeaderedEvent,
|
||||||
|
txnID string,
|
||||||
) error {
|
) error {
|
||||||
// Create the transaction body.
|
// Create the transaction body.
|
||||||
transaction, err := json.Marshal(
|
transaction, err := json.Marshal(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue