Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix programming evaluation polling #7426

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adi-herwana-nus
Copy link

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

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
- 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 c3bc31d to d88d555 Compare July 17, 2024 03:38
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