Skip to content

Mahika - 🔥 echo requestId for every timer action [BE] - #2474

Merged
one-community merged 1 commit into
developmentfrom
mahika/timer-requestid-echo
Nov 6, 2026
Merged

one-community merged 1 commit into
developmentfrom
mahika/timer-requestid-echo

Conversation

@mahikakakkad

@mahikakakkad mahikakakkad commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Description

Before logging time from the Timer, the frontend now checks the timer's current state with the server (GET_TIMER) and waits for the server to reply with the same requestId. The server only did this for STOP_TIMER, so that check always waited the full 5-second timeout before every time log. This makes the server echo requestId for any action, so the check comes back right away.

Related PRS (if any):

Required by the frontend PR: OneCommunityGlobal/HighestGoodNetworkApp#5788
Merge order: this PR first, then OneCommunityGlobal/HighestGoodNetworkApp#5751, then the frontend PR above.

Main changes explained:

  • clientsHandler.js: echo requestId for any action that sends one, not just STOP_TIMER. STOP_TIMER works the same as before.
  • clientsHandler.spec.js: tests that GET_TIMER echoes requestId, STOP_TIMER still does, and a GET_TIMER after another tab stopped the timer reports it as stopped.

How to test:

  1. Check out this branch, npm install, build, and start the backend
  2. Run the frontend PR above against it
  3. Start the timer, let it run past 1 minute, then stop and log the time
  4. The timer stops right away, with no ~5 second wait

Screenshots or videos of changes:

N/A, backend only.

Note:

None.

@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

@one-community one-community added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Nov 6, 2026

@vidiyala99 vidiyala99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 505d63c. All 9 tests in src/websockets/TimerService/clientsHandler.spec.js pass locally, including the new GET_TIMER echo cases.

The change is small and safe on its own. A requestId is echoed only when the client sends one. On development the frontend sends one only with STOP_TIMER and matches replies by exact id, so the existing stop confirmation is unchanged. Tabs that didn't send an id ignore the field. Approving.

One thing for merge planning: this PR is only needed for OneCommunityGlobal/HighestGoodNetworkApp#5788. I requested changes there tonight. Once this echo is live, a retry after a failed save gets "started: false" back from GET_TIMER, and the form throws the time away. Also, #5788 and OneCommunityGlobal/HighestGoodNetworkApp#5778 fix the same timer bug and conflict with each other. If #5778 is the one that merges, this PR isn't needed. If #5788 merges, merge this one only after its retry issue is fixed.

@one-community

Copy link
Copy Markdown
Member

Thank you all, merging!

@one-community
one-community merged commit b599ad1 into development Nov 6, 2026
4 checks passed
@one-community one-community changed the title Mahika - fix: echo requestId for every timer action [BE] Mahika - 🔥 echo requestId for every timer action [BE] Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants