Skip to content

Commit

Permalink
clear vm slice on hv init
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrizhu committed Mar 6, 2024
1 parent 2481718 commit faaaebb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/controllers/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ func (hv *HV) InitVMs() error {

hv.Mutex.Lock()
defer hv.Mutex.Unlock()
// Clear VMs
hv.VMs = nil
// Load the VMs of a hypervisor into memory
for i := range dbVMs {
id := dbVMs[i].ID
Expand Down
2 changes: 1 addition & 1 deletion internal/server/routes/admin/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func CreateUser(w http.ResponseWriter, r *http.Request) {
func GetUsers(w http.ResponseWriter, r *http.Request) {
rows, err := db.Pool.Query(context.Background(), "SELECT * FROM profile")
if err != nil {
eUtil.WriteError(w, r, err, http.StatusInternalServerError, "Failed to list users")
eUtil.WriteError(w, r, err, http.StatusInternalServerError, "Failed to get users")
return
}
defer rows.Close()
Expand Down

0 comments on commit faaaebb

Please sign in to comment.