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
Background
In #5945, cheyang suggested extracting the shared job-status checking body from
OnceStatusHandler.GetOperationStatusandOnEventStatusHandler.GetOperationStatusinto a small helper function, since both handlers inDataLoadandDataMigratecontain 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 bothpkg/controllers/v1alpha1/dataload/status_handler.goandpkg/controllers/v1alpha1/datamigrate/status_handler.goso thatOnceStatusHandlerandOnEventStatusHandlercall it instead of duplicating the logic. This makes future status-handling fixes a single edit instead of four.References