Skip to content

Commit b3e96fc

Browse files
committed
Refactor WorkflowStatusLatestService package imports and CI status fetching in CiHandlerImpl to improve logging and error handling consistency.
1 parent 02fd2b4 commit b3e96fc

File tree

5 files changed

+4
-3
lines changed

5 files changed

+4
-3
lines changed

pkg/pipeline/CiHandler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ func (impl *CiHandlerImpl) fetchCiWorkflowStatusFromLatestEntries(latestCiWorkfl
700700

701701
workflows, err := impl.ciWorkflowRepository.FindWorkflowsByCiWorkflowIds(workflowIds)
702702
if err != nil {
703+
impl.Logger.Errorw("error in fetching ci workflows by ci workflow ids", "workflowIds", workflowIds, "err", err)
703704
return nil, err
704705
}
705706

@@ -712,14 +713,14 @@ func (impl *CiHandlerImpl) fetchCiWorkflowStatusFromLatestEntries(latestCiWorkfl
712713
return statuses, nil
713714
}
714715

715-
// fetchCiStatusUsingFallbackMethod fetches CI status directly from workflow table having multiple joins
716+
// fetchCiStatusUsingFallbackMethod fetches CI status directly from ci_workflow table
716717
func (impl *CiHandlerImpl) fetchCiStatusUsingFallbackMethod(pipelineIds []int) ([]*pipelineConfig.CiWorkflowStatus, error) {
717718
workflows, err := impl.ciWorkflowRepository.FindLastTriggeredWorkflowByCiIds(pipelineIds)
718719
if err != nil {
720+
impl.Logger.Errorw("error in fetching ci workflows by ci ids", "pipelineIds", pipelineIds, "err", err)
719721
return nil, err
720722
}
721723

722-
// Convert to CiWorkflowStatus format
723724
var statuses []*pipelineConfig.CiWorkflowStatus
724725
for _, workflow := range workflows {
725726
status := adapter.GetCiWorkflowStatusFromCiWorkflow(workflow)

pkg/workflow/wire_workflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ package workflow
1919
import (
2020
"github.com/devtron-labs/devtron/pkg/workflow/cd"
2121
"github.com/devtron-labs/devtron/pkg/workflow/status"
22-
"github.com/devtron-labs/devtron/pkg/workflow/status/workflowStatusLatest"
2322
"github.com/devtron-labs/devtron/pkg/workflow/trigger/audit/hook"
2423
"github.com/devtron-labs/devtron/pkg/workflow/trigger/audit/repository"
2524
"github.com/devtron-labs/devtron/pkg/workflow/trigger/audit/service"
25+
"github.com/devtron-labs/devtron/pkg/workflow/workflowStatusLatest"
2626
"github.com/google/wire"
2727
)
2828

0 commit comments

Comments
 (0)