Skip to content

fix programming evaluation polling - #7426

Merged
cysjonathan merged 1 commit into
masterfrom
adi/fix-programming-evaluation-polling
Oct 28, 2024
Merged

fix programming evaluation polling#7426
cysjonathan merged 1 commit into
masterfrom
adi/fix-programming-evaluation-polling

Conversation

@adi-herwana-nus

@adi-herwana-nus adi-herwana-nus commented Jul 8, 2024

Copy link
Copy Markdown
Contributor

This PR fixes continued polling for autograding jobs on the programming submission edit page after the user navigates away (and double polling when they navigate back). Since the autograding job polling would only affect that page's UI, polling should only occur when the user is on that page.

Previous Behavior

Fetching submission details triggered a setInterval() timer (via pollJob() helper function) to poll the backend for ongoing autograding jobs. This timer was not cleared with clearInterval() when the user navigated away, resulting in the timer being effectively orphaned.
Clicking "Run Code" button also calls the pollJob() helper function, leading to the same behavior.

New Behavior

Fetching submission details no longer triggers polling automatically. Instead, polling is now managed by the SubmissionEditIndex React component:

  • This component starts polling timers (one for live feedback and one for evaluation) on mount and clears it on unmount.
  • The evaluation timer polls for autograding jobs in progress, which is determined by the question data in the Redux state.
  • When the user clicks "Run Code," the Redux state is updated to start polling for that specific question.

Both operations no longer use pollJob() helper function. In the future, we might want to revisit whether we want to rewrite other occurrences of the function to avoid the orphan timer issue, or decide if there are some polling calls that should persist between pages.

@adi-herwana-nus
adi-herwana-nus marked this pull request as ready for review July 10, 2024 07:21
@adi-herwana-nus
adi-herwana-nus force-pushed the adi/fix-programming-evaluation-polling branch from c3bc31d to d88d555 Compare July 17, 2024 03:38
@adi-herwana-nus
adi-herwana-nus force-pushed the adi/fix-programming-evaluation-polling branch from d88d555 to e783da6 Compare October 22, 2024 14:52
- polling now handled by SubmissionEditIndex component, timers started on mount and cleared on unmount
- autograding job polling (from page load and "Run Code" button) moved from pollJob to component timers
@adi-herwana-nus
adi-herwana-nus force-pushed the adi/fix-programming-evaluation-polling branch from e783da6 to 29e5805 Compare October 22, 2024 14:56
@cysjonathan
cysjonathan merged commit fe47f4d into master Oct 28, 2024
@cysjonathan
cysjonathan deleted the adi/fix-programming-evaluation-polling branch October 28, 2024 10:19
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.

2 participants