diff --git a/pyaci/upload.py b/pyaci/upload.py index 75ee2e2..5aa1bca 100755 --- a/pyaci/upload.py +++ b/pyaci/upload.py @@ -44,6 +44,8 @@ def sync_time(self): print(str.format("Synced time: %s" %(result))) def radio_obs_from_update(self, update): + if not update.is_valid: + return [] obs = [] for remote_id, rssi in zip(update.proximity_ids, update.proximity_rssi): ob_time = datetime.datetime.utcfromtimestamp(update.valid_time) @@ -61,7 +63,8 @@ def run(self): if len(updates) > 0: obs = [self.radio_obs_from_update(update) for update in updates] flattened_obs = [ob for sublist in obs for ob in sublist] - self.api.upload_obs(flattened_obs) + if len(flattened_obs) > 0: + self.api.upload_obs(flattened_obs) else: time.sleep(0.5) if time.time() - self.last_time_sync > Uploader.TIME_SYNC_INTERVAL: