Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix restricting video upload to wifi #192

Merged
merged 1 commit into from
Mar 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions selfdrive/loggerd/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down