Refresh dendrite subtree - pull changes for appservice bug (#457)

Co-authored-by: Tak Wai Wong <tak@hntlabs.com>
This commit is contained in:
Tak Wai Wong 2022-09-15 14:15:31 -07:00 committed by GitHub
parent 6275dd0b25
commit 55341ef3cf
2 changed files with 6 additions and 4 deletions

1
.gitignore vendored
View file

@ -53,6 +53,7 @@ _testmain.go
# Default configuration file
dendrite.yaml
zion-appservice.yaml
# Database files
*.db

View file

@ -173,13 +173,14 @@ func (s *OutputRoomEventConsumer) sendEvents(
return err
}
// TODO: We should probably be more intelligent and pick something not
// in the control of the event. A NATS timestamp header or something maybe.
txnID := events[0].Event.OriginServerTS()
// If the number of items in the array is different,
// then this should be treated as a different transaction. Incorporate the length
// of events into the transaction ID.
txnID := fmt.Sprintf("%d_%d", events[0].Event.OriginServerTS(), len(transaction))
// Send the transaction to the appservice.
// https://matrix.org/docs/spec/application_service/r0.1.2#put-matrix-app-v1-transactions-txnid
address := fmt.Sprintf("%s/transactions/%d?access_token=%s", state.URL, txnID, url.QueryEscape(state.HSToken))
address := fmt.Sprintf("%s/transactions/%s?access_token=%s", state.URL, txnID, url.QueryEscape(state.HSToken))
req, err := http.NewRequestWithContext(ctx, "PUT", address, bytes.NewBuffer(transaction))
if err != nil {
return err