Get detailed process information
()
| 16631 | except Exception: |
| 16632 | return None |
| 16633 | return (dt if dt.tzinfo else dt.replace(tzinfo=timezone.utc)).timestamp() |
| 16634 | |
| 16635 | |
| 16636 | def _auto_upload_process_once(): |
| 16637 | if not _AUTO_UPLOAD_PROC_LOCK.acquire(blocking=False): |
| 16638 | return # another pass is already running |
| 16639 | try: |
| 16640 | items = _auto_upload_load() |
| 16641 | if not items: |
| 16642 | return |
| 16643 | remaining = [] |
| 16644 | now = time.time() |
| 16645 | for it in items: |
| 16646 | if it.get('next_try', 0) > now: |
| 16647 | remaining.append(it) |
| 16648 | continue |
| 16649 | sid = it.get('session_id') |
| 16650 | target = (it.get('target') or 'wdgwars').lower() |
| 16651 | todo = _upload_target_list(target) |
| 16652 | if not todo: |
| 16653 | continue # unknown target (hand-edited queue) - drop it |
| 16654 | it['attempts'] = it.get('attempts', 0) + 1 |
| 16655 | it['next_try'] = now + _AUTO_UPLOAD_RETRY_S |
| 16656 | try: |
| 16657 | csv_text = _wardrive_session_csv(sid) |
| 16658 | if _wardrive_located_count(csv_text) == 0: |
| 16659 | # No GPS-pinned rows (yet); keep it a while, then give up. |
| 16660 | if it['attempts'] < 30: |
| 16661 | remaining.append(it) |
| 16662 | else: |
| 16663 | _upload_mark(sid, located=0) |
| 16664 | for t in todo: |
| 16665 | _upload_record(sid, t, state='skipped', message='No GPS-pinned rows in this drive') |
| 16666 | continue |
| 16667 | _upload_mark(sid, located=_wardrive_located_count(csv_text)) |
| 16668 | results = _upload_session(sid, todo, csv_text) |