aboutsummaryrefslogtreecommitdiff
path: root/federationsender
diff options
context:
space:
mode:
Diffstat (limited to 'federationsender')
-rw-r--r--federationsender/internal/api.go16
-rw-r--r--federationsender/internal/perform.go2
-rw-r--r--federationsender/queue/destinationqueue.go2
3 files changed, 18 insertions, 2 deletions
diff --git a/federationsender/internal/api.go b/federationsender/internal/api.go
index f9d35357..31617045 100644
--- a/federationsender/internal/api.go
+++ b/federationsender/internal/api.go
@@ -109,6 +109,8 @@ func (a *FederationSenderInternalAPI) doRequest(
func (a *FederationSenderInternalAPI) GetUserDevices(
ctx context.Context, s gomatrixserverlib.ServerName, userID string,
) (gomatrixserverlib.RespUserDevices, error) {
+ ctx, cancel := context.WithTimeout(ctx, time.Second*30)
+ defer cancel()
ires, err := a.doRequest(s, func() (interface{}, error) {
return a.federation.GetUserDevices(ctx, s, userID)
})
@@ -121,6 +123,8 @@ func (a *FederationSenderInternalAPI) GetUserDevices(
func (a *FederationSenderInternalAPI) ClaimKeys(
ctx context.Context, s gomatrixserverlib.ServerName, oneTimeKeys map[string]map[string]string,
) (gomatrixserverlib.RespClaimKeys, error) {
+ ctx, cancel := context.WithTimeout(ctx, time.Second*30)
+ defer cancel()
ires, err := a.doRequest(s, func() (interface{}, error) {
return a.federation.ClaimKeys(ctx, s, oneTimeKeys)
})
@@ -145,6 +149,8 @@ func (a *FederationSenderInternalAPI) QueryKeys(
func (a *FederationSenderInternalAPI) Backfill(
ctx context.Context, s gomatrixserverlib.ServerName, roomID string, limit int, eventIDs []string,
) (res gomatrixserverlib.Transaction, err error) {
+ ctx, cancel := context.WithTimeout(ctx, time.Second*30)
+ defer cancel()
ires, err := a.doRequest(s, func() (interface{}, error) {
return a.federation.Backfill(ctx, s, roomID, limit, eventIDs)
})
@@ -157,6 +163,8 @@ func (a *FederationSenderInternalAPI) Backfill(
func (a *FederationSenderInternalAPI) LookupState(
ctx context.Context, s gomatrixserverlib.ServerName, roomID, eventID string, roomVersion gomatrixserverlib.RoomVersion,
) (res gomatrixserverlib.RespState, err error) {
+ ctx, cancel := context.WithTimeout(ctx, time.Second*30)
+ defer cancel()
ires, err := a.doRequest(s, func() (interface{}, error) {
return a.federation.LookupState(ctx, s, roomID, eventID, roomVersion)
})
@@ -169,6 +177,8 @@ func (a *FederationSenderInternalAPI) LookupState(
func (a *FederationSenderInternalAPI) LookupStateIDs(
ctx context.Context, s gomatrixserverlib.ServerName, roomID, eventID string,
) (res gomatrixserverlib.RespStateIDs, err error) {
+ ctx, cancel := context.WithTimeout(ctx, time.Second*30)
+ defer cancel()
ires, err := a.doRequest(s, func() (interface{}, error) {
return a.federation.LookupStateIDs(ctx, s, roomID, eventID)
})
@@ -181,6 +191,8 @@ func (a *FederationSenderInternalAPI) LookupStateIDs(
func (a *FederationSenderInternalAPI) GetEvent(
ctx context.Context, s gomatrixserverlib.ServerName, eventID string,
) (res gomatrixserverlib.Transaction, err error) {
+ ctx, cancel := context.WithTimeout(ctx, time.Second*30)
+ defer cancel()
ires, err := a.doRequest(s, func() (interface{}, error) {
return a.federation.GetEvent(ctx, s, eventID)
})
@@ -193,6 +205,8 @@ func (a *FederationSenderInternalAPI) GetEvent(
func (a *FederationSenderInternalAPI) GetServerKeys(
ctx context.Context, s gomatrixserverlib.ServerName,
) (gomatrixserverlib.ServerKeys, error) {
+ ctx, cancel := context.WithTimeout(ctx, time.Second*30)
+ defer cancel()
ires, err := a.doRequest(s, func() (interface{}, error) {
return a.federation.GetServerKeys(ctx, s)
})
@@ -205,6 +219,8 @@ func (a *FederationSenderInternalAPI) GetServerKeys(
func (a *FederationSenderInternalAPI) LookupServerKeys(
ctx context.Context, s gomatrixserverlib.ServerName, keyRequests map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.Timestamp,
) ([]gomatrixserverlib.ServerKeys, error) {
+ ctx, cancel := context.WithTimeout(ctx, time.Minute)
+ defer cancel()
ires, err := a.doRequest(s, func() (interface{}, error) {
return a.federation.LookupServerKeys(ctx, s, keyRequests)
})
diff --git a/federationsender/internal/perform.go b/federationsender/internal/perform.go
index 0c9dd257..d014ca5c 100644
--- a/federationsender/internal/perform.go
+++ b/federationsender/internal/perform.go
@@ -42,7 +42,7 @@ type federatedJoin struct {
RoomID string
}
-// PerformJoinRequest implements api.FederationSenderInternalAPI
+// PerformJoin implements api.FederationSenderInternalAPI
func (r *FederationSenderInternalAPI) PerformJoin(
ctx context.Context,
request *api.PerformJoinRequest,
diff --git a/federationsender/queue/destinationqueue.go b/federationsender/queue/destinationqueue.go
index e87f0063..29fef705 100644
--- a/federationsender/queue/destinationqueue.go
+++ b/federationsender/queue/destinationqueue.go
@@ -349,7 +349,7 @@ func (oq *destinationQueue) nextTransaction() (bool, error) {
// TODO: we should check for 500-ish fails vs 400-ish here,
// since we shouldn't queue things indefinitely in response
// to a 400-ish error
- ctx, cancel = context.WithTimeout(context.Background(), time.Second*30)
+ ctx, cancel = context.WithTimeout(context.Background(), time.Minute*5)
defer cancel()
_, err = oq.client.SendTransaction(ctx, t)
switch err.(type) {