fix: address Globalping code review findings

## Changes

### Critical fixes
- Fix Switch `isChecked` → `checked` prop in CreateMonitor Globalping toggle
- Merge double `getDBSettings()` calls in globalpingService into single
  `getClientAndLocations()` method to eliminate redundant DB reads per check cycle
- Add in-flight lock (Set) to prevent overlapping Globalping checks for the same monitor
- Add hostname validation before calling Globalping API to prevent invalid targets

### Dead code removal
- Remove unused `locations` field from server Monitor type, Mongoose model,
  Joi validation, and repository mappers
- Remove unused `locations` field from client Monitor type
- Remove dead `getLimits()` method from globalpingService
- Remove dead `locations` translation keys from en.json
- Remove dead `monitorType`, `groupedUpChecks`, `groupedDownChecks` fields
  from findLocationChecksByMonitorId return value

### Medium/low fixes
- Make globalping/locations API fetch conditional on `monitor.globalpingEnabled`
  in Details page to avoid unnecessary requests
- Add useEffect to reset selectedLocationTab when location keys change
  to prevent out-of-bounds tab index
- Add `globalpingEnabled: false` to default case in useMonitorForm
- Replace console.log with comment in CreateMonitor onError handler
- Add aria-label to Globe icon for accessibility
- Add warning log when Globalping buildCheck returns undefined
- Fix step numbering in SuperSimpleQueueHelper (was duplicated Step 4)

## Benefits
- Eliminates one DB round-trip per monitor check cycle
- Prevents race conditions with overlapping Globalping checks
- Validates hostnames before external API calls
- Removes ~30 lines of dead code across server and client
- Improves accessibility with proper aria labels
This commit is contained in:
gorkem-bwl committed 2026-02-19 13:28:38 -05:00
1 parent bfdf28a2cc
commit b7c9e2710a
13 files changed
+72 -73

No files matched your search

-7
View File
@@ -496,12 +496,6 @@
"hardware": "Monitor CPU, memory, disk usage, and temperature for your infrastructure."
}
},
"locations": {
"title": "Global locations",
"description": "Run uptime checks from multiple geographic regions using Globalping. Select up to 5 locations.",
"label": "Check locations",
"placeholder": "Select locations"
},
"ignoreTls": {
"description": "Configure TLS/SSL certificate validation for HTTPS connections.",
"option": {
@@ -1158,7 +1152,6 @@
"table": {
"headers": {
"responseTime": "Response time",
"locations": "Locations",
"globalpingEnabled": "Global monitoring enabled"
}
},