Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing statuscode for poll call, update error string #5404

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
backendconfig "github.com/rudderlabs/rudder-server/backend-config"
"github.com/rudderlabs/rudder-server/jobsdb"
"github.com/rudderlabs/rudder-server/router/batchrouter/asyncdestinationmanager/common"
obskit "github.com/rudderlabs/rudder-observability-kit/go/labels"
)

const (
Expand Down Expand Up @@ -118,10 +119,12 @@ func (kbu *KlaviyoBulkUploader) Poll(pollInput common.AsyncPoll) common.PollStat
allComplete = false
pollresp, err := kbu.KlaviyoAPIService.GetUploadStatus(importId)
if err != nil {
kbu.Logger.Errorn("Error during fetching Klaviyo Bulk Upload status", obskit.Error(err))
return common.PollStatusResponse{
Complete: true,
HasFailed: true,
Error: err.Error(),
StatusCode: 500,
Complete: true,
HasFailed: true,
Error: `Error during fetching upload status ` + err.Error(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion router/batchrouter/handle_async.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (brt *Handle) updatePollStatusToDB(
}
}
} else if pollResp.StatusCode == http.StatusBadRequest {
statusList, _, jobIDConnectionDetailsMap = brt.prepareJobStatusList(importingList, jobsdb.JobStatusT{JobState: jobsdb.Aborted.State, ErrorResponse: misc.UpdateJSONWithNewKeyVal(routerutils.EmptyPayload, "error", "poll failed with status code 400")}, sourceID, destinationID)
statusList, _, jobIDConnectionDetailsMap = brt.prepareJobStatusList(importingList, jobsdb.JobStatusT{JobState: jobsdb.Aborted.State, ErrorResponse: misc.UpdateJSONWithNewKeyVal(routerutils.EmptyPayload, "error", pollResp.Error)}, sourceID, destinationID)
if err := brt.updateJobStatuses(ctx, destinationID, importingList, importingList, statusList); err != nil {
brt.logger.Errorf("[Batch Router] Failed to update job status for Dest Type %v with error %v", brt.destType, err)
return statusList, err
Expand Down
Loading