Skip to content

fix(ClassroomMonitor): Recover student statuses missed while the socket was down - #2363

Open
Isaries wants to merge 1 commit into
WISE-Community:developfrom
Isaries:fix/teacher-socket-reconnect
Open

Isaries wants to merge 1 commit into
WISE-Community:developfrom
Isaries:fix/teacher-socket-reconnect

Conversation

@Isaries

@Isaries Isaries commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

The simple broker keeps nothing for a subscriber that is not connected, so any student status sent while the teacher's socket was reconnecting was lost until the page was reloaded. Student statuses are now fetched again on every connect. This includes the first connect, which also covers statuses posted between the initial student-status request and the socket connecting.

The response is merged rather than replacing the list. A workgroup whose status arrived over the socket while a refresh was in flight keeps that status, since the response may be older. A fetched status also never replaces one with a newer server timestamp, so when refreshes overlap after quick successive reconnects and the earlier one returns last, its older rows are ignored. Statuses received over the socket carry no server timestamp, which is why the in-flight record is still needed. Workgroups missing from the loaded config are skipped, as retrieveStudentStatuses() does, and only statuses that changed are broadcast, so a reconnect does not re-render every open page.

The config reload triggered by newWorkgroupJoinedRun was built but never subscribed, so the request was never sent and new teams did not appear. It is now subscribed, debounced so that a burst of teams joining causes one reload, and restartable, and a failed reload does not stop later ones. Re-initializing the service now deactivates the previous STOMP client and tears down all of its subscriptions.

Testing: new teacherWebSocketService.spec.ts and new refreshStudentStatuses tests in classroomStatusService.spec.ts. On develop three fail and the rest do not compile, since the method does not exist. Full suite: 2507 pass, with one failure that also fails on develop (millisecondsToDateTime(), time zone dependent).

…et was down

The simple broker keeps nothing for a subscriber that is not connected, so
any student status sent while the teacher's socket was reconnecting was lost
until the page was reloaded. Student statuses are now fetched again on every
connect, including the first one, which also covers statuses posted between
the initial request and the socket connecting. The response is merged
rather than replacing the list: a workgroup whose status arrived over the
socket while any refresh was in flight keeps that status, a fetched status
never replaces one with a newer server timestamp, workgroups missing
from the loaded config are skipped as retrieveStudentStatuses() does, and
only statuses that changed are broadcast.

The classroom monitor config reload on newWorkgroupJoinedRun was never
subscribed, so new workgroups did not appear. It is now subscribed, debounced
and restartable, and an error does not stop later reloads.

Re-initializing now deactivates the previous STOMP client and tears down all
of its subscriptions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant