Skip to content

Investigate session expiry pause behavior (errcode -14) #20

@Oaklight

Description

@Oaklight

Background

The official SDK pauses for 1 hour when receiving errcode -14 (session expired). Our current implementation raises SessionExpiredError and the dispatcher stops immediately.

Current behavior

  • _protocol.py: errcode == -14 → raises SessionExpiredError
  • client.py _poll_loop: catches SessionExpiredErrorbreak (dispatcher stops)
  • User must manually re-login

Questions to investigate

  1. Does the session auto-recover after the 1-hour pause, or is re-login always required?
  2. Is the 1-hour pause a server-imposed cooldown (will immediate re-login fail)?
  3. How frequently does session expiry occur in normal usage?
  4. Does the server return any additional fields with errcode -14 (retry hints, TTL)?

Phase 1 (logging)

  • Enhanced logging on SessionExpiredError: full error details, timestamp
  • Log complete response body when errcode == -14

Phase 2 (implementation, based on findings)

  • If auto-recovery: sleep + retry with configurable duration
  • If re-login required: keep break + provide callback/event hook
  • Consider exposing a on_session_expired event

Files

  • src/weilink/_protocol.py
  • src/weilink/client.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — nice to haveneeds-investigationRequires live API investigationprotocoliLink Bot protocol layer

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions