Problem/Motivation

  • The code that sends live updates to the browser was one big function with a once-a-second loop. It was hard to test, which is where the recent "stuck progress bar" bug had been hiding.
  • Moved the decision-making into a new TaskMonitorStream class. You give it the current tasks and the time, and it tells you what to send to the browser and when to close the connection. It doesn't touch the database or wait, so it can be tested on its own.
  • TaskMonitorController is now just the thin layer that loads the tasks, sends the updates, and waits between checks.
  • Turned WorkspaceTask back into a plain data object: dropped the \Drupal::getContainer() call it used to look up its handler, and refreshProgress() now gets the handler and the current time passed in instead.

Issue fork wse-3605972

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

amateescu created an issue. See original summary.

amateescu’s picture

Title: TaskMonitorStream » Refactor wse_task_monitor SSE loop into a testable stream class and clean up WorkspaceTask

  • amateescu committed 23b899ab on 3.0.x
    task: #3605972 Refactor wse_task_monitor SSE loop into a testable stream...
amateescu’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

amateescu’s picture

Issue summary: View changes