Browse Source

auto update script executed

Toby Chui 1 year ago
parent
commit
5ce80c6be7
1 changed files with 4 additions and 3 deletions
  1. 4 3
      mod/uptime/uptime.go

+ 4 - 3
mod/uptime/uptime.go

@@ -46,7 +46,7 @@ var exampleTarget = Target{
 	Protocol: "https",
 }
 
-//Create a new uptime monitor
+// Create a new uptime monitor
 func NewUptimeMonitor(config *Config) (*Monitor, error) {
 	//Create new monitor object
 	thisMonitor := Monitor{
@@ -140,8 +140,8 @@ func (m *Monitor) RemoveTargetFromMonitor(targetId string) {
 	delete(m.OnlineStatusLog, targetId)
 }
 
-//Scan the config target. If a target exists in m.OnlineStatusLog no longer
-//exists in m.Monitor.Config.Targets, it remove it from the log as well.
+// Scan the config target. If a target exists in m.OnlineStatusLog no longer
+// exists in m.Monitor.Config.Targets, it remove it from the log as well.
 func (m *Monitor) CleanRecords() {
 	// Create a set of IDs for all targets in the config
 	targetIDs := make(map[string]bool)
@@ -223,5 +223,6 @@ func getWebsiteStatus(url string) (int, error) {
 		return 0, err
 	}
 	status_code := resp.StatusCode
+	resp.Body.Close()
 	return status_code, nil
 }