Skip to content

Conversation

@its-mitesh-kumar
Copy link
Member

@its-mitesh-kumar its-mitesh-kumar commented Jan 27, 2026

Description

Implements dynamic polling for import task status in the bulk import repository table. This provides real-time feedback during active imports while reducing API load for idle repositories.

Changes

  • Active tasks (Processing, Active, Pending): Poll every 10 seconds for real-time status updates
  • Completed/idle repos: Poll every 60 seconds, aligned to consistent interval marks
  • Added refetchOnWindowFocus: false to prevent unnecessary API calls on tab focus

How it works

The refetchInterval is now a function that:

  1. Checks the current task/workflow status
  2. Returns 10s interval for active tasks (Task in progress)
  3. For completed/ideal repo poll every 60 seconds

Fixes

UI after changes

Screen.Recording.2026-01-27.at.5.23.35.PM.mov
  • A changeset describing the change and affected packages. (more info)
  • Added or Updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)

Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
@its-mitesh-kumar its-mitesh-kumar requested review from a team, debsmita1 and rm3l as code owners January 27, 2026 12:25
@its-mitesh-kumar its-mitesh-kumar requested review from christoph-jerolimov and removed request for a team January 27, 2026 12:25
@rhdh-gh-app
Copy link

rhdh-gh-app bot commented Jan 27, 2026

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-bulk-import workspaces/bulk-import/plugins/bulk-import minor v6.11.1

@sonarqubecloud
Copy link

@its-mitesh-kumar
Copy link
Member Author

/cc @christoph-jerolimov @ShiranHi PTAL.

@its-mitesh-kumar
Copy link
Member Author

/cc @lokanandaprabhu

Copy link
Member

@lokanandaprabhu lokanandaprabhu left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Member

@christoph-jerolimov christoph-jerolimov left a comment

Choose a reason for hiding this comment

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

I don't want block this, but I have two small questions:

// If exactly at boundary, wait full interval; otherwise wait until next boundary
return remainder === 0 ? intervalMs : intervalMs - remainder;
},
refetchOnWindowFocus: false,

Choose a reason for hiding this comment

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

Does this feature make sense to keep on?

Copy link
Member Author

Choose a reason for hiding this comment

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

@christoph-jerolimov Since we're already polling every 60 seconds (or 10 seconds for active tasks), an additional API call on window focus would be redundant. The polling ensures data stays fresh, so disabling refetchOnWindowFocus reduces unnecessary API calls without impacting the user experience.

Comment on lines +96 to +101
// Calculate time until next 60-second aligned interval
const elapsed = Date.now() - startTimeRef.current;
const intervalMs = 60000;
const remainder = elapsed % intervalMs;
// If exactly at boundary, wait full interval; otherwise wait until next boundary
return remainder === 0 ? intervalMs : intervalMs - remainder;

Choose a reason for hiding this comment

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

Why do you do any fetch non active jobs? A failed job will be also failed a minute later, or?

Copy link
Member Author

Choose a reason for hiding this comment

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

@christoph-jerolimov A repository's status can change externally - another team member could re-import a previously failed repo, or a new import could be triggered. Polling at 60s ensures we reflect the current state even for repos that weren't actively being imported by the current user.

@christoph-jerolimov
Copy link
Member

This is a much better UX. Thanks @its-mitesh-kumar 👍

@christoph-jerolimov
Copy link
Member

Maybe you can answer my questions anyway but I think this is a big improvement already. Thanks for this 👍

@christoph-jerolimov christoph-jerolimov merged commit 2adef63 into redhat-developer:main Jan 28, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants