mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 14:53:10 -06:00
Synchronous perform-join as long as possible
This commit is contained in:
parent
a3e401e5dd
commit
b5d5907d69
|
|
@ -186,8 +186,15 @@ func (r *FederationSenderInternalAPI) performJoinUsingServer(
|
||||||
}
|
}
|
||||||
r.statistics.ForServer(serverName).Success()
|
r.statistics.ForServer(serverName).Success()
|
||||||
|
|
||||||
|
// Process the join response in a goroutine. The idea here is
|
||||||
|
// that we'll try and wait for as long as possible for the work
|
||||||
|
// to complete, but if the client does give up waiting, we'll
|
||||||
|
// still continue to process the join anyway so that we don't
|
||||||
|
// waste the effort.
|
||||||
|
var cancel context.CancelFunc
|
||||||
|
ctx, cancel = context.WithCancel(context.Background())
|
||||||
go func() {
|
go func() {
|
||||||
ctx = context.Background()
|
defer cancel()
|
||||||
|
|
||||||
// Check that the send_join response was valid.
|
// Check that the send_join response was valid.
|
||||||
joinCtx := perform.JoinContext(r.federation, r.keyRing)
|
joinCtx := perform.JoinContext(r.federation, r.keyRing)
|
||||||
|
|
@ -219,6 +226,7 @@ func (r *FederationSenderInternalAPI) performJoinUsingServer(
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
<-ctx.Done()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue