Give UpdateMachine a more meaningful name

This commit is contained in:
Kristoffer Dalby 2022-05-30 12:18:23 +02:00
parent dbc1d981c9
commit a992840c9b
2 changed files with 7 additions and 7 deletions

View file

@ -362,9 +362,9 @@ func (h *Headscale) GetMachineByMachineKey(
return &m, nil
}
// UpdateMachine takes a Machine struct pointer (typically already loaded from database
// UpdateMachineFromDatabase takes a Machine struct pointer (typically already loaded from database
// and updates it with the latest data from the database.
func (h *Headscale) UpdateMachine(machine *Machine) error {
func (h *Headscale) UpdateMachineFromDatabase(machine *Machine) error {
if result := h.db.Find(machine).First(&machine); result.Error != nil {
return result.Error
}
@ -463,7 +463,7 @@ func (machine *Machine) GetHostInfo() tailcfg.Hostinfo {
}
func (h *Headscale) isOutdated(machine *Machine) bool {
if err := h.UpdateMachine(machine); err != nil {
if err := h.UpdateMachineFromDatabase(machine); err != nil {
// It does not seem meaningful to propagate this error as the end result
// will have to be that the machine has to be considered outdated.
return true