From 66936a691cad061b6693f3740f36759681eb0e70 Mon Sep 17 00:00:00 2001 From: xssfox Date: Sun, 28 Jul 2024 17:18:27 +1000 Subject: [PATCH] handle when sondehub db doesn't have a frequency listed for recovery ingestion --- .terraform.lock.hcl | 3 +++ lambda/recovery_ingest/__init__.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index 04f121e..d348aaf 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -4,6 +4,7 @@ provider "registry.terraform.io/hashicorp/archive" { version = "2.4.0" hashes = [ + "h1:ZtsrX5F13Ohsv/k/BvgyBVn0gF+lW4bkG7JmCGrN35Y=", "h1:cJokkjeH1jfpG4QEHdRx0t2j8rr52H33A7C/oX73Ok4=", "zh:18e408596dd53048f7fc8229098d0e3ad940b92036a24287eff63e2caec72594", "zh:392d4216ecd1a1fd933d23f4486b642a8480f934c13e2cae3c13b6b6a7e34a7b", @@ -23,6 +24,7 @@ provider "registry.terraform.io/hashicorp/archive" { provider "registry.terraform.io/hashicorp/aws" { version = "5.22.0" hashes = [ + "h1:4oAjE3Fn/vXruaORPWH1lH7q/+oPEqxNm6+KjOMeMrI=", "h1:XuU3tsGzElMt4Ti8SsM05pFllNMwSC4ScUxcfsOS140=", "zh:09b8475cd519c945423b1e1183b71a4209dd2927e0d289a88c5abeecb53c1753", "zh:2448e0c3ce9b991a5dd70f6a42d842366a6a2460cf63b31fb9bc5d2cc92ced19", @@ -46,6 +48,7 @@ provider "registry.terraform.io/hashicorp/random" { version = "3.5.1" hashes = [ "h1:IL9mSatmwov+e0+++YX2V6uel+dV6bn+fC/cnGDK3Ck=", + "h1:sZ7MTSD4FLekNN2wSNFGpM+5slfvpm5A/NLVZiB7CO0=", "zh:04e3fbd610cb52c1017d282531364b9c53ef72b6bc533acb2a90671957324a64", "zh:119197103301ebaf7efb91df8f0b6e0dd31e6ff943d231af35ee1831c599188d", "zh:4d2b219d09abf3b1bb4df93d399ed156cadd61f44ad3baf5cf2954df2fba0831", diff --git a/lambda/recovery_ingest/__init__.py b/lambda/recovery_ingest/__init__.py index d480db8..bf50af2 100644 --- a/lambda/recovery_ingest/__init__.py +++ b/lambda/recovery_ingest/__init__.py @@ -62,7 +62,9 @@ def findSonde(recovery, lat, lon): timeDifference = receivedTime - launchTime if timeDifference.total_seconds() < 10800: # 3 Hours or less if value["type"] in sondeType: # Type matches - if abs(float(sondeFrequency) - float(value["frequency"])) < 0.05: # 0.05 MHz or less + if "frequency" in value and abs(float(sondeFrequency) - float(value["frequency"])) < 0.05: # 0.05 MHz or less + serial = key + elif "frequency" not in value: # if frequency not in sondehub db assume its right anyway. serial = key return serial