Title: fix(net): wait_until_online() never actually waits (always-truthy bug) by jnuyens · Pull Request #176 · MicroPythonOS/MicroPythonOS · GitHub
Open Graph Title: fix(net): wait_until_online() never actually waits (always-truthy bug) by jnuyens · Pull Request #176 · MicroPythonOS/MicroPythonOS
X Title: fix(net): wait_until_online() never actually waits (always-truthy bug) by jnuyens · Pull Request #176 · MicroPythonOS/MicroPythonOS
Description: Summary ConnectivityManager.wait_until_online() has a bug that makes it return True immediately even when the device is offline, so it never actually waits. def wait_until_online(self, timeout=60): if not self.can_check_network: return True start = time.time() while time.time() - start < timeout: if self.is_online: # <-- bug: is_online is a METHOD return True time.sleep(1) return False is_online is a method (def is_online(self): return self._is_online), so if self.is_online: tests a bound-method object, which is always truthy. The loop returns True on its first iteration regardless of actual connectivity. Fix Call the method: if self.is_online(): return True One-line change. Any caller relying on wait_until_online() to block until connectivity is restored now behaves correctly. Test Added an offline regression test to the existing TestConnectivityManagerWaitUntilOnline class. With a disconnected mock network, wait_until_online(timeout=0.5) must return False (it returned True instantly before the fix): $ ./tests/unittest.sh tests/test_connectivity_manager.py Ran 26 tests OK ASCII-only, no new dependencies.
Open Graph Description: Summary ConnectivityManager.wait_until_online() has a bug that makes it return True immediately even when the device is offline, so it never actually waits. def wait_until_online(self, timeout=60):...
X Description: Summary ConnectivityManager.wait_until_online() has a bug that makes it return True immediately even when the device is offline, so it never actually waits. def wait_until_online(self, timeout=60):...
Opengraph URL: https://github.com/MicroPythonOS/MicroPythonOS/pull/176
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:42332962-f327-0aa0-0edd-c0fc0f680fcd |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C262:3446C2:3B9DD4:51CFB6:6A5141A0 |
| html-safe-nonce | b2e4fc611909ced391eaf2b5c23a9b471083d921d74eb4e20cb059b514faed04 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjYyOjM0NDZDMjozQjlERDQ6NTFDRkI2OjZBNTE0MUEwIiwidmlzaXRvcl9pZCI6IjY5MDEyNjMxODA4MjA5ODgzMjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5e340432f11e2216570ed2cf44c40706871c8e4866e6af04184322cb15b8c640 |
| hovercard-subject-tag | pull_request:3949457090 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/MicroPythonOS/MicroPythonOS/pull/176/files |
| twitter:image | https://avatars.githubusercontent.com/u/3696148?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/3696148?s=400&v=4 |
| og:image:alt | Summary ConnectivityManager.wait_until_online() has a bug that makes it return True immediately even when the device is offline, so it never actually waits. def wait_until_online(self, timeout=60):... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | e840f405b2718e8f2d55aafa9ff27dbce17e29d0c253011d05ea0fea3c78baff |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/MicroPythonOS/MicroPythonOS git https://github.com/MicroPythonOS/MicroPythonOS.git |
| octolytics-dimension-user_id | 213598128 |
| octolytics-dimension-user_login | MicroPythonOS |
| octolytics-dimension-repository_id | 975472483 |
| octolytics-dimension-repository_nwo | MicroPythonOS/MicroPythonOS |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 975472483 |
| octolytics-dimension-repository_network_root_nwo | MicroPythonOS/MicroPythonOS |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e876f00c5723f6080b9d294e4958fd4d506e6faf |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width