Skip to content

[$45 BOUNTY] [Go] Add WebSocket hub lifecycle tests #1

Description

@jackjin1997

Bounty: $45 (LT)

Area: market/ws/server.go

Current state: The WebSocket hub manages client registration, unregister, ping/pong deadlines, and broadcast fan-out, but there is no focused test coverage for lifecycle behavior. The broadcast path also removes slow clients from Hub.clients while holding RLock, so the expected cleanup behavior should be covered before further changes.

What is needed: Add Go tests for the WebSocket hub lifecycle and tighten the slow-client cleanup path if the tests expose the locking issue.

Acceptance criteria:

  • Cover client registration and unregister removing clients exactly once.
  • Cover broadcast delivery to active clients.
  • Cover slow/full client send buffers being removed without mutating Hub.clients under a read lock.
  • Cover ping/write loop shutdown or close behavior where practical without long sleeps.
  • Keep the change scoped to market/ws lifecycle logic and tests.

Required validation:

  • Run go test ./market/ws or the closest package-level Go test command available in this repo.
  • Run python3 build.py.
  • Include the generated diagnostic/build-*.logd artifact from diagnostic/; include the matching diagnostic/build-*.json if present.
  • Use .github/pull_request_template.md for the submission.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bountyBounty issuegood first issueGood for first-time contributorshelp wantedOpen for external contributionlanguage:goGo language task

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions