← Commit history

0.5.41: widget helper retries its bind

John Lauer ·3c23ed2ade ·1mo ago ·parent 8277fc0
3 files changed +13−4
bin/hydrogen-widget-lib.py+10−1
@@ -79,7 +79,16 @@ def serve(title, data_fn, render_js, refresh_ms=60000, mark=None):             if self.path.startswith('/data.json'): self._send(200, 'application/json', json.dumps(data()).encode())             elif self.path.startswith('/health'): self._send(200, 'application/json', b'{"ok":true}')             else: self._send(200, 'text/html; charset=utf-8', (PAGE % {'title': title, 'refresh_ms': refresh_ms, 'render_js': render_js, 'mark_svg': ('<svg viewBox="0 0 16 16">' + mark['svg'] + '</svg>') if mark['svg'] else '', 'mark_color': mark['color']}).encode())-    srv = ThreadingHTTPServer(('127.0.0.1', port), H)+    # Bind with retries: a previous instance Hydrogen just stopped may still be releasing the+    # port for a moment. Ten tries over five seconds, then give up loudly (the log says why).+    ThreadingHTTPServer.allow_reuse_address = True+    srv = None+    for attempt in range(10):+        try:+            srv = ThreadingHTTPServer(('127.0.0.1', port), H); break+        except OSError as e:+            if attempt == 9: raise+            time.sleep(0.5)     # Tell Hydrogen we are up (the health poll would find us anyway; this is the explicit handshake).     ctl = os.environ.get('ADOM_HD_CONTROL_URL'); wid = os.environ.get('HYDROGEN_WIDGET_ID')     if ctl and wid:
package.json+1−1
@@ -4,7 +4,7 @@   "type": "bootstrap",   "title": "Adom Hydrogen (platform base)",   "brief": "Layer Hydrogen's workspace onto a standard Adom workstation.",-  "version": "0.5.40",+  "version": "0.5.41",   "description": "Hydrogen's PLATFORM-GENERIC workspace layer on top of adom/core. Installs adom/core for the full Adom ecosystem, then adds everything common to running inside Hydrogen on ANY platform: the runtime-neutral hydrogen-* skills and the generic editor configuration (Claude Code CLI + extension, VS Code settings, trusted domains). Platform-specific layers depend on THIS: adom/hydrogen-windows-bootstrap (WSL2), adom/hydrogen-mac-bootstrap, adom/hydrogen-ubuntu-bootstrap. The reference design other orgs copy to build their own bootstrap on adom/core.",   "org": "adom",   "tags": [
page.json+2−2
@@ -4,7 +4,7 @@   "type": "bootstrap",   "title": "Adom Hydrogen (platform base)",   "brief": "Layer Hydrogen's workspace onto a standard Adom workstation.",-  "version": "0.5.40",+  "version": "0.5.41",   "description": "Hydrogen's PLATFORM-GENERIC workspace layer on top of adom/core. Installs adom/core for the full Adom ecosystem, then adds everything common to running inside Hydrogen on ANY platform: the runtime-neutral hydrogen-* skills and the generic editor configuration (Claude Code CLI + extension, VS Code settings, trusted domains). Platform-specific layers depend on THIS: adom/hydrogen-windows-bootstrap (WSL2), adom/hydrogen-mac-bootstrap, adom/hydrogen-ubuntu-bootstrap. The reference design other orgs copy to build their own bootstrap on adom/core.",   "org": "adom",   "tags": [@@ -49,4 +49,4 @@     "hydrogen editor configuration",     "where do hydrogen skills come from"   ]-}\ No newline at end of file+}