mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-25 15:53:09 -06:00
Update federation timeouts
This commit is contained in:
parent
429c473c92
commit
65a16b0ce8
|
|
@ -89,7 +89,7 @@ func createClient(
|
||||||
"matrix",
|
"matrix",
|
||||||
p2phttp.NewTransport(base.LibP2P, p2phttp.ProtocolOption("/matrix")),
|
p2phttp.NewTransport(base.LibP2P, p2phttp.ProtocolOption("/matrix")),
|
||||||
)
|
)
|
||||||
return gomatrixserverlib.NewClientWithTransport(true, tr)
|
return gomatrixserverlib.NewClientWithTransport(tr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ func (n *Node) CreateClient(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return gomatrixserverlib.NewClientWithTransport(true, tr)
|
return gomatrixserverlib.NewClientWithTransport(tr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) CreateFederationClient(
|
func (n *Node) CreateFederationClient(
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,8 @@ func (a *FederationSenderInternalAPI) doRequest(
|
||||||
func (a *FederationSenderInternalAPI) GetUserDevices(
|
func (a *FederationSenderInternalAPI) GetUserDevices(
|
||||||
ctx context.Context, s gomatrixserverlib.ServerName, userID string,
|
ctx context.Context, s gomatrixserverlib.ServerName, userID string,
|
||||||
) (gomatrixserverlib.RespUserDevices, error) {
|
) (gomatrixserverlib.RespUserDevices, error) {
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, time.Second*30)
|
||||||
|
defer cancel()
|
||||||
ires, err := a.doRequest(s, func() (interface{}, error) {
|
ires, err := a.doRequest(s, func() (interface{}, error) {
|
||||||
return a.federation.GetUserDevices(ctx, s, userID)
|
return a.federation.GetUserDevices(ctx, s, userID)
|
||||||
})
|
})
|
||||||
|
|
@ -121,6 +123,8 @@ func (a *FederationSenderInternalAPI) GetUserDevices(
|
||||||
func (a *FederationSenderInternalAPI) ClaimKeys(
|
func (a *FederationSenderInternalAPI) ClaimKeys(
|
||||||
ctx context.Context, s gomatrixserverlib.ServerName, oneTimeKeys map[string]map[string]string,
|
ctx context.Context, s gomatrixserverlib.ServerName, oneTimeKeys map[string]map[string]string,
|
||||||
) (gomatrixserverlib.RespClaimKeys, error) {
|
) (gomatrixserverlib.RespClaimKeys, error) {
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, time.Second*30)
|
||||||
|
defer cancel()
|
||||||
ires, err := a.doRequest(s, func() (interface{}, error) {
|
ires, err := a.doRequest(s, func() (interface{}, error) {
|
||||||
return a.federation.ClaimKeys(ctx, s, oneTimeKeys)
|
return a.federation.ClaimKeys(ctx, s, oneTimeKeys)
|
||||||
})
|
})
|
||||||
|
|
@ -145,6 +149,8 @@ func (a *FederationSenderInternalAPI) QueryKeys(
|
||||||
func (a *FederationSenderInternalAPI) Backfill(
|
func (a *FederationSenderInternalAPI) Backfill(
|
||||||
ctx context.Context, s gomatrixserverlib.ServerName, roomID string, limit int, eventIDs []string,
|
ctx context.Context, s gomatrixserverlib.ServerName, roomID string, limit int, eventIDs []string,
|
||||||
) (res gomatrixserverlib.Transaction, err error) {
|
) (res gomatrixserverlib.Transaction, err error) {
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, time.Second*30)
|
||||||
|
defer cancel()
|
||||||
ires, err := a.doRequest(s, func() (interface{}, error) {
|
ires, err := a.doRequest(s, func() (interface{}, error) {
|
||||||
return a.federation.Backfill(ctx, s, roomID, limit, eventIDs)
|
return a.federation.Backfill(ctx, s, roomID, limit, eventIDs)
|
||||||
})
|
})
|
||||||
|
|
@ -157,6 +163,8 @@ func (a *FederationSenderInternalAPI) Backfill(
|
||||||
func (a *FederationSenderInternalAPI) LookupState(
|
func (a *FederationSenderInternalAPI) LookupState(
|
||||||
ctx context.Context, s gomatrixserverlib.ServerName, roomID, eventID string, roomVersion gomatrixserverlib.RoomVersion,
|
ctx context.Context, s gomatrixserverlib.ServerName, roomID, eventID string, roomVersion gomatrixserverlib.RoomVersion,
|
||||||
) (res gomatrixserverlib.RespState, err error) {
|
) (res gomatrixserverlib.RespState, err error) {
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, time.Second*30)
|
||||||
|
defer cancel()
|
||||||
ires, err := a.doRequest(s, func() (interface{}, error) {
|
ires, err := a.doRequest(s, func() (interface{}, error) {
|
||||||
return a.federation.LookupState(ctx, s, roomID, eventID, roomVersion)
|
return a.federation.LookupState(ctx, s, roomID, eventID, roomVersion)
|
||||||
})
|
})
|
||||||
|
|
@ -169,6 +177,8 @@ func (a *FederationSenderInternalAPI) LookupState(
|
||||||
func (a *FederationSenderInternalAPI) LookupStateIDs(
|
func (a *FederationSenderInternalAPI) LookupStateIDs(
|
||||||
ctx context.Context, s gomatrixserverlib.ServerName, roomID, eventID string,
|
ctx context.Context, s gomatrixserverlib.ServerName, roomID, eventID string,
|
||||||
) (res gomatrixserverlib.RespStateIDs, err error) {
|
) (res gomatrixserverlib.RespStateIDs, err error) {
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, time.Second*30)
|
||||||
|
defer cancel()
|
||||||
ires, err := a.doRequest(s, func() (interface{}, error) {
|
ires, err := a.doRequest(s, func() (interface{}, error) {
|
||||||
return a.federation.LookupStateIDs(ctx, s, roomID, eventID)
|
return a.federation.LookupStateIDs(ctx, s, roomID, eventID)
|
||||||
})
|
})
|
||||||
|
|
@ -181,6 +191,8 @@ func (a *FederationSenderInternalAPI) LookupStateIDs(
|
||||||
func (a *FederationSenderInternalAPI) GetEvent(
|
func (a *FederationSenderInternalAPI) GetEvent(
|
||||||
ctx context.Context, s gomatrixserverlib.ServerName, eventID string,
|
ctx context.Context, s gomatrixserverlib.ServerName, eventID string,
|
||||||
) (res gomatrixserverlib.Transaction, err error) {
|
) (res gomatrixserverlib.Transaction, err error) {
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, time.Second*30)
|
||||||
|
defer cancel()
|
||||||
ires, err := a.doRequest(s, func() (interface{}, error) {
|
ires, err := a.doRequest(s, func() (interface{}, error) {
|
||||||
return a.federation.GetEvent(ctx, s, eventID)
|
return a.federation.GetEvent(ctx, s, eventID)
|
||||||
})
|
})
|
||||||
|
|
@ -193,6 +205,8 @@ func (a *FederationSenderInternalAPI) GetEvent(
|
||||||
func (a *FederationSenderInternalAPI) GetServerKeys(
|
func (a *FederationSenderInternalAPI) GetServerKeys(
|
||||||
ctx context.Context, s gomatrixserverlib.ServerName,
|
ctx context.Context, s gomatrixserverlib.ServerName,
|
||||||
) (gomatrixserverlib.ServerKeys, error) {
|
) (gomatrixserverlib.ServerKeys, error) {
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, time.Second*30)
|
||||||
|
defer cancel()
|
||||||
ires, err := a.doRequest(s, func() (interface{}, error) {
|
ires, err := a.doRequest(s, func() (interface{}, error) {
|
||||||
return a.federation.GetServerKeys(ctx, s)
|
return a.federation.GetServerKeys(ctx, s)
|
||||||
})
|
})
|
||||||
|
|
@ -205,6 +219,8 @@ func (a *FederationSenderInternalAPI) GetServerKeys(
|
||||||
func (a *FederationSenderInternalAPI) LookupServerKeys(
|
func (a *FederationSenderInternalAPI) LookupServerKeys(
|
||||||
ctx context.Context, s gomatrixserverlib.ServerName, keyRequests map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.Timestamp,
|
ctx context.Context, s gomatrixserverlib.ServerName, keyRequests map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.Timestamp,
|
||||||
) ([]gomatrixserverlib.ServerKeys, error) {
|
) ([]gomatrixserverlib.ServerKeys, error) {
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, time.Minute)
|
||||||
|
defer cancel()
|
||||||
ires, err := a.doRequest(s, func() (interface{}, error) {
|
ires, err := a.doRequest(s, func() (interface{}, error) {
|
||||||
return a.federation.LookupServerKeys(ctx, s, keyRequests)
|
return a.federation.LookupServerKeys(ctx, s, keyRequests)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ type federatedJoin struct {
|
||||||
RoomID string
|
RoomID string
|
||||||
}
|
}
|
||||||
|
|
||||||
// PerformJoinRequest implements api.FederationSenderInternalAPI
|
// PerformJoin implements api.FederationSenderInternalAPI
|
||||||
func (r *FederationSenderInternalAPI) PerformJoin(
|
func (r *FederationSenderInternalAPI) PerformJoin(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *api.PerformJoinRequest,
|
request *api.PerformJoinRequest,
|
||||||
|
|
|
||||||
|
|
@ -254,9 +254,9 @@ func (b *BaseDendrite) CreateClient() *gomatrixserverlib.Client {
|
||||||
// CreateFederationClient creates a new federation client. Should only be called
|
// CreateFederationClient creates a new federation client. Should only be called
|
||||||
// once per component.
|
// once per component.
|
||||||
func (b *BaseDendrite) CreateFederationClient() *gomatrixserverlib.FederationClient {
|
func (b *BaseDendrite) CreateFederationClient() *gomatrixserverlib.FederationClient {
|
||||||
client := gomatrixserverlib.NewFederationClient(
|
client := gomatrixserverlib.NewFederationClientWithTimeout(
|
||||||
b.Cfg.Global.ServerName, b.Cfg.Global.KeyID, b.Cfg.Global.PrivateKey,
|
b.Cfg.Global.ServerName, b.Cfg.Global.KeyID, b.Cfg.Global.PrivateKey,
|
||||||
b.Cfg.FederationSender.DisableTLSValidation,
|
b.Cfg.FederationSender.DisableTLSValidation, time.Minute*5,
|
||||||
)
|
)
|
||||||
client.SetUserAgent(fmt.Sprintf("Dendrite/%s", internal.VersionString()))
|
client.SetUserAgent(fmt.Sprintf("Dendrite/%s", internal.VersionString()))
|
||||||
return client
|
return client
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ func newFedClient(tripper func(*http.Request) (*http.Response, error)) *gomatrix
|
||||||
fedClient := gomatrixserverlib.NewFederationClient(
|
fedClient := gomatrixserverlib.NewFederationClient(
|
||||||
gomatrixserverlib.ServerName("example.test"), gomatrixserverlib.KeyID("ed25519:test"), pkey, true,
|
gomatrixserverlib.ServerName("example.test"), gomatrixserverlib.KeyID("ed25519:test"), pkey, true,
|
||||||
)
|
)
|
||||||
fedClient.Client = *gomatrixserverlib.NewClientWithTransport(true, &roundTripper{tripper})
|
fedClient.Client = *gomatrixserverlib.NewClientWithTransport(&roundTripper{tripper})
|
||||||
return fedClient
|
return fedClient
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue