Skip to content

Commit

Permalink
use description from sensor def file if saving loc to db.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboulware committed Jan 15, 2024
1 parent fc3e6db commit 1b0258e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gunicorn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def post_worker_init(worker):
db_location = Location.objects.get(active=True)
location = construct_geojson_point(db_location.longitude, db_location.latitude, db_location.height)
except Location.DoesNotExist:
#No DB location. Use sensor def location and save to DB.
# This should never occur because status/migrations/0003_auto_20211217_2229.py
# will load the No DB location. Use sensor def location and save to DB.
location = construct_geojson_point(
sensor_loc["x"],
sensor_loc["y"],
Expand All @@ -81,7 +82,7 @@ def post_worker_init(worker):
db_location.latitude = sensor_loc["y"]
db_location.height = sensor_loc["z"]
db_location.gps = False
db_location.description = "Sensor Definition Location"
db_location.description = sensor_loc["description"]
db_location.save()
except:
logger.exception("Failed to get sensor location from sensor definition.")
Expand Down

0 comments on commit 1b0258e

Please sign in to comment.