Skip to content

Commit 81dcba0

Browse files
committed
fix: remove base64 decode for jobs api example
Signed-off-by: mikeee <[email protected]>
1 parent 17579cd commit 81dcba0

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

Diff for: examples/dist-scheduler/main.go

+2-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"context"
5-
"encoding/base64"
65
"encoding/json"
76
"fmt"
87
"log"
@@ -96,19 +95,11 @@ func main() {
9695
var jobCount = 0
9796

9897
func prodDBBackupHandler(ctx context.Context, job *common.JobEvent) error {
99-
var jobData common.Job
100-
if err := json.Unmarshal(job.Data, &jobData); err != nil {
101-
return fmt.Errorf("failed to unmarshal job: %v", err)
102-
}
103-
decodedPayload, err := base64.StdEncoding.DecodeString(jobData.Value)
104-
if err != nil {
105-
return fmt.Errorf("failed to decode job payload: %v", err)
106-
}
10798
var jobPayload api.DBBackup
108-
if err := json.Unmarshal(decodedPayload, &jobPayload); err != nil {
99+
if err := json.Unmarshal(job.Data, &jobPayload); err != nil {
109100
return fmt.Errorf("failed to unmarshal payload: %v", err)
110101
}
111-
fmt.Printf("job %d received:\n type: %v \n typeurl: %v\n value: %v\n extracted payload: %v\n", jobCount, job.JobType, jobData.TypeURL, jobData.Value, jobPayload)
102+
fmt.Printf("job %d received:\n type: %v \n payload: %v\n", jobCount, job.JobType, jobPayload)
112103
jobCount++
113104
return nil
114105
}

0 commit comments

Comments
 (0)