mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-25 11:16:11 +01:00
Backport #29629 (cherry picked from commit 2f1eb619bc19a9b172062ba17789356bbdaa259d)
This commit is contained in:
parent
9f7a51d3d7
commit
7a32382108
|
@ -118,7 +118,15 @@ func (g *Manager) start(ctx context.Context) {
|
||||||
defer close(startupDone)
|
defer close(startupDone)
|
||||||
// Wait till we're done getting all of the listeners and then close
|
// Wait till we're done getting all of the listeners and then close
|
||||||
// the unused ones
|
// the unused ones
|
||||||
g.createServerWaitGroup.Wait()
|
func() {
|
||||||
|
// FIXME: there is a fundamental design problem of the "manager" and the "wait group".
|
||||||
|
// If nothing has started, the "Wait" just panics: sync: WaitGroup is reused before previous Wait has returned
|
||||||
|
// There is no clear solution besides a complete rewriting of the "manager"
|
||||||
|
defer func() {
|
||||||
|
_ = recover()
|
||||||
|
}()
|
||||||
|
g.createServerWaitGroup.Wait()
|
||||||
|
}()
|
||||||
// Ignore the error here there's not much we can do with it
|
// Ignore the error here there's not much we can do with it
|
||||||
// They're logged in the CloseProvidedListeners function
|
// They're logged in the CloseProvidedListeners function
|
||||||
_ = CloseProvidedListeners()
|
_ = CloseProvidedListeners()
|
||||||
|
|
|
@ -227,7 +227,15 @@ func (g *Manager) awaitServer(limit time.Duration) bool {
|
||||||
c := make(chan struct{})
|
c := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
defer close(c)
|
defer close(c)
|
||||||
g.createServerWaitGroup.Wait()
|
func() {
|
||||||
|
// FIXME: there is a fundamental design problem of the "manager" and the "wait group".
|
||||||
|
// If nothing has started, the "Wait" just panics: sync: WaitGroup is reused before previous Wait has returned
|
||||||
|
// There is no clear solution besides a complete rewriting of the "manager"
|
||||||
|
defer func() {
|
||||||
|
_ = recover()
|
||||||
|
}()
|
||||||
|
g.createServerWaitGroup.Wait()
|
||||||
|
}()
|
||||||
}()
|
}()
|
||||||
if limit > 0 {
|
if limit > 0 {
|
||||||
select {
|
select {
|
||||||
|
|
Loading…
Reference in a new issue