Add a sleep to reduce the impact of
@@ -21,6 +21,7 @@ import (
)
const (
+ registrationHoldoff = time.Second * 5 // TODO(juan): remove this once https://github.com/juanfont/headscale/issues/727 is fixed
reservedResponseHeaderSize = 4
RegisterMethodAuthKey = "authkey"
RegisterMethodOIDC = "oidc"
@@ -237,11 +238,17 @@ func (h *Headscale) RegistrationHandler(
Str("Followup", registerRequest.Followup).
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)
return
}
}
+ }
log.Info().
Caller().
