Repository navigation
Conversation
When a new workgroup joins the run, the classroom topic sends a newWorkgroupJoinedRun message and the student side calls ConfigService.retrieveConfig() to refresh its roster. retrieveConfig() returns a cold HTTP observable and nothing subscribed to it, so the request was never made and classmateUserInfos kept the roster from page load. Discussion posts get their author names from that roster when they arrive, so posts by late joiners showed a user id fallback or nothing until the student reloaded. The message now feeds a subject that requests the config at most once per audit window, so a whole class joining produces one request per tab while joins keep arriving, and a random per-tab window keeps the class from requesting at the same instant. A failed request is swallowed so later joins still refresh, and initialize() replaces any earlier pipeline instead of adding a second one. DiscussionStudent re-applies names to the posts it already shows when a new config is retrieved, unless responses are anonymized. Anonymous names come from each workgroup's index in the period's alphabetically sorted roster. Once the roster refreshes mid-session, a newcomer sorted in ahead of a classmate or a team leaving would shift those indexes and give later posts another classmate's pseudonym, and every author missing from the roster shared the last slot. DiscussionService now keeps the workgroup order it first read for each run and period and appends authors it has not seen to the end of it, so for the rest of the session in that tab each team keeps the pseudonym it was first shown under and newcomers get distinct ones.
The roster refresh audits newWorkgroupJoinedRun messages and maps each audit tick to a config request with switchMap. While a class keeps joining, the audit window closes again every few seconds and switchMap cancels the request still in flight. If the config endpoint takes longer than the window to answer, no request completes until the joins stop. Use concatMap instead so each request runs to completion and the request for the latest joins still runs after the one before it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Discussion posts by a team that joined the run after a student opened it show no author name on that student's screen until the student reloads. When a workgroup joins, the classroom topic sends
newWorkgroupJoinedRunandStudentWebSocketServicecallsConfigService.retrieveConfig()to refresh the roster, butretrieveConfig()returns a cold HTTP observable and nothing subscribes to it, so the request is never made. Posts are named fromclassmateUserInfoswhen they arrive, and that roster stays as it was at page load.This is the normal way a class starts: students join with the access code over the first minutes, and whoever opened the unit first sees an increasing share of their classmates' posts and "reply" notifications without names.
Changes
auditTime, at most once per window per tab.auditTimerather thandebounceTime, so the roster keeps refreshing while a class is still joining. The window is 2 to 5 seconds, chosen per tab, so a whole class does not request the config at the same instant. Each request is mapped withconcatMapand runs to completion, so a server slower than the window still answers during a burst instead of having every request cancelled by the next. A failed request is swallowed so later joins still refresh, andinitialize()replaces any earlier pipeline.DiscussionStudentre-applies names to the posts it already shows when a new config is retrieved, unless responses are anonymized.DiscussionServicenow keeps the order it first read for each run and period and appends authors it has not seen to the end, so within a session each team keeps the pseudonym it was first shown under and newcomers get distinct ones. Pseudonyms already differ between viewers today; that is reported separately in Discussion anonymous names refer to different students for different viewers #2393 and not changed here.Test
studentWebSocketService.spec.ts: the config is requested, once for a burst of joins, repeatedly while joins keep arriving one second apart, again after a failed request, and through one pipeline after a secondinitialize(). Against the currentdevelop, the request cases fail withExpected 0 to equal 1.discussion-student.component.spec.ts: a post by a team missing from the roster gets its name once the config is retrieved again.discussionService.spec.ts: a classmate keeps its pseudonym after a newcomer joins and after a team leaves, and authors missing from the roster neither take a classmate's pseudonym nor share one. Against the currentdevelop, these fail with messages such asExpected 'Anonymous Fox' to equal 'Anonymous Lion'.should finish slow config requests while joins keep arriving: with a request slower than the window, requests still complete while joins continue. WithswitchMapit fails withExpected 0 to be greater than or equal 2.