Skip to content

Commit

Permalink
fix: Jobs go/sdk event data payload
Browse files Browse the repository at this point in the history
  • Loading branch information
tazarov committed Oct 6, 2024
1 parent bfb887e commit a322918
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions jobs/go/sdk/job-service/job-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ dapr run --app-id maintenance-scheduler --app-port 5200 --dapr-http-port 5280 --

import (
"context"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -201,16 +200,8 @@ func deleteJob(ctx context.Context, in *common.InvocationEvent) (out *common.Con

// Handler that handles job events
func handleJob(ctx context.Context, job *common.JobEvent) error {
var jobData common.Job
if err := json.Unmarshal(job.Data, &jobData); err != nil {
return fmt.Errorf("failed to unmarshal job: %v", err)
}
decodedPayload, err := base64.StdEncoding.DecodeString(jobData.Value)
if err != nil {
return fmt.Errorf("failed to decode job payload: %v", err)
}
var jobPayload JobData
if err := json.Unmarshal(decodedPayload, &jobPayload); err != nil {
if err := json.Unmarshal(job.Data, &jobPayload); err != nil {
return fmt.Errorf("failed to unmarshal payload: %v", err)
}

Expand Down

0 comments on commit a322918

Please sign in to comment.