Add contexts to the internal roomserver APIs (#228)

This commit is contained in:
Mark Haines 2017-09-13 13:37:50 +01:00 committed by GitHub
parent 79adba43f0
commit 3133bef797
26 changed files with 177 additions and 87 deletions

View file

@ -15,6 +15,7 @@
package main
import (
"context"
"fmt"
"io/ioutil"
"os"
@ -199,7 +200,7 @@ func writeToRoomServer(input []string, roomserverURL string) error {
}
}
x := api.NewRoomserverInputAPIHTTP(roomserverURL, nil)
return x.InputRoomEvents(&request, &response)
return x.InputRoomEvents(context.Background(), &request, &response)
}
// testRoomserver is used to run integration tests against a single roomserver.
@ -389,10 +390,11 @@ func main() {
testRoomserver(input, want, func(q api.RoomserverQueryAPI) {
var response api.QueryLatestEventsAndStateResponse
if err := q.QueryLatestEventsAndState(
context.Background(),
&api.QueryLatestEventsAndStateRequest{
RoomID: "!HCXfdvrfksxuYnIFiJ:matrix.org",
StateToFetch: []gomatrixserverlib.StateKeyTuple{
{"m.room.member", "@richvdh:matrix.org"},
{EventType: "m.room.member", StateKey: "@richvdh:matrix.org"},
},
},
&response,