piker/piker
Gud Boi 709269fcf7 Cache ws-token on `Client` and auto-refresh
Add `_ws_token` cache attr to `Client` with a
`force_renewal` flag on `get_ws_token()`. Drop
the `token` param threading through
`handle_order_requests()` and
`handle_order_updates()` — all call sites now
use `await client.get_ws_token()` instead.

Deats,
- `api.py`: add `_ws_token: str|None = None`,
  return cached token unless `force_renewal`,
  comment out `InvalidKey`/`InvalidSession`
  classes and `reg_err_types()` call (WIP move).
- `broker.py`: drop `token` param from
  `handle_order_requests()`,
  `handle_order_updates()`, and call sites;
  replace all `token` refs with
  `await client.get_ws_token()`.
- `subscribe()`: rework `InvalidSession` handling
  to match on `(etype_str, ev_msg)` tuple, call
  `get_ws_token(force_renewal=True)` and
  `continue` the sub-ack loop; extract `fmt_msg`
  var to avoid repeated `ppfmt()` calls.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-04-14 14:29:26 -04:00
..
accounting Enable console logging in `.accounting` on import 2026-02-23 12:22:48 -05:00
brokers Cache ws-token on `Client` and auto-refresh 2026-04-14 14:29:26 -04:00
clearing Enable console via `.clearing._ems.open_brokerd_dialog()` 2026-02-23 12:22:48 -05:00
cli Update `tractor` private-API refs across codebase 2026-03-24 20:21:29 -04:00
data Move `reg_err_types` imports to module-level 2026-03-30 13:25:41 -04:00
fsp Use `tractor.ipc._shm` types directly across codebase 2026-03-17 18:00:29 -04:00
service Always re-raise in `maybe_spawn_daemon()` handler 2026-03-31 19:43:27 -04:00
storage Move `reg_err_types` imports to module-level 2026-03-30 13:25:41 -04:00
testing Pass a config `tmp_dir: Path` to the runtime when testing 2023-03-09 15:37:43 -05:00
toolz Delegate `.toolz.open_crash_handler()` to `tractor.devx` 2024-01-16 10:26:38 -05:00
tsp Update `tractor` private-API refs across codebase 2026-03-24 20:21:29 -04:00
ui Use `tn` for nursery vars in UI modules 2026-04-01 14:05:08 -04:00
watchlists Add license headers to pertinent files 2020-11-06 12:23:14 -05:00
__init__.py Start `piker.service` sub-package 2023-03-09 15:37:42 -05:00
_cacheables.py Move `._cacheables.open_cached_client()` into `.brokers` pkg mod 2023-06-27 13:41:47 -04:00
calc.py Lul, adhere to returning `str`s in `humanize()` 2022-01-25 07:57:01 -05:00
config.py Improve `load_accounts()` logging and defaults 2026-03-31 14:16:40 -04:00
log.py Auto-enable `tractor` logging when runtime active 2026-02-23 12:22:48 -05:00
types.py Point `.types.Struct` to `tractor.msg.pretty_struct` 2026-02-22 16:07:53 -05:00