Skip to content

[Refactor] Extract shared job-status helper between OnceStatusHandler and OnEventStatusHandler in DataLoad and DataMigrate #6065

Description

@adityaupasani2

Background

In #5945, cheyang suggested extracting the shared job-status checking body from OnceStatusHandler.GetOperationStatus and OnEventStatusHandler.GetOperationStatus into a small helper function, since both handlers in DataLoad and DataMigrate contain near-identical logic for looking up the triggered job, checking its finished condition, and returning phase/duration/conditions.

The suggestion was deferred as non-blocking to keep the fix focused. This issue tracks the follow-up.

What to do

Extract a shared helper (e.g. getJobOperationStatus) in both pkg/controllers/v1alpha1/dataload/status_handler.go and pkg/controllers/v1alpha1/datamigrate/status_handler.go so that OnceStatusHandler and OnEventStatusHandler call it instead of duplicating the logic. This makes future status-handling fixes a single edit instead of four.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions