Merge pull request #192 from gregjhogan/wifi-only-upload-fix

fix restricting video upload to wifi
old-commit-hash: ad3f0a348a
commatwo_master
George Hotz 7 years ago committed by GitHub
commit 911f3d6112
  1. 37
      selfdrive/loggerd/uploader.py

@ -248,33 +248,30 @@ def uploader_fn(exit_event):
uploader = Uploader(dongle_id, access_token, ROOT)
backoff = 0.1
while True:
upload_video = (params.get("IsUploadVideoOverCellularEnabled") != "0") or is_on_wifi()
backoff = 0.1
while True:
if exit_event.is_set():
return
if exit_event.is_set():
return
d = uploader.next_file_to_upload(upload_video)
if d is None:
break
d = uploader.next_file_to_upload(upload_video)
if d is None:
time.sleep(5)
continue
key, fn, _ = d
key, fn, _ = d
cloudlog.info("to upload %r", d)
success = uploader.upload(key, fn)
if success:
backoff = 0.1
else:
cloudlog.info("backoff %r", backoff)
time.sleep(backoff + random.uniform(0, backoff))
backoff = min(backoff*2, 120)
cloudlog.info("upload done, success=%r", success)
time.sleep(5)
cloudlog.info("to upload %r", d)
success = uploader.upload(key, fn)
if success:
backoff = 0.1
else:
cloudlog.info("backoff %r", backoff)
time.sleep(backoff + random.uniform(0, backoff))
backoff = min(backoff*2, 120)
cloudlog.info("upload done, success=%r", success)
def main(gctx=None):
uploader_fn(threading.Event())

Loading…
Cancel
Save