mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-27 12:05:26 +00:00
Add a sleep to reduce the impact of #727
This commit is contained in:
parent
8e56d8b425
commit
e1e3feb6a8
7
api.go
7
api.go
@ -21,6 +21,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
registrationHoldoff = time.Second * 5 // TODO(juan): remove this once https://github.com/juanfont/headscale/issues/727 is fixed
|
||||||
reservedResponseHeaderSize = 4
|
reservedResponseHeaderSize = 4
|
||||||
RegisterMethodAuthKey = "authkey"
|
RegisterMethodAuthKey = "authkey"
|
||||||
RegisterMethodOIDC = "oidc"
|
RegisterMethodOIDC = "oidc"
|
||||||
@ -237,11 +238,17 @@ func (h *Headscale) RegistrationHandler(
|
|||||||
Str("Followup", registerRequest.Followup).
|
Str("Followup", registerRequest.Followup).
|
||||||
Msg("Machine is waiting for interactive login")
|
Msg("Machine is waiting for interactive login")
|
||||||
|
|
||||||
|
ticker := time.NewTicker(registrationHoldoff)
|
||||||
|
select {
|
||||||
|
case <-req.Context().Done():
|
||||||
|
return
|
||||||
|
case <-ticker.C:
|
||||||
h.handleMachineRegistrationNew(writer, req, machineKey, registerRequest)
|
h.handleMachineRegistrationNew(writer, req, machineKey, registerRequest)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log.Info().
|
log.Info().
|
||||||
Caller().
|
Caller().
|
||||||
|
Loading…
Reference in New Issue
Block a user