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

refactor: refactor message handling and encoding in queue system #138

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

appleboy
Copy link
Member

  • Remove Encode method call in BenchmarkQueue function
  • Add TaskMessage interface extending QueuedMessage with Payload method
  • Rename Payload field to Body in Message struct
  • Add Payload method to Message struct to return Body
  • Replace Data field and Encode method in Message struct with Bytes method using JSON marshalling
  • Update NewMessage to use Body instead of Payload
  • Add documentation for Encode method in job package
  • Update TestMessageEncodeDecode to use Payload() method
  • Replace Encode method call with direct handling of task in Queue methods
  • Change logger from Errorf to Fatalf in Queue error handling
  • Add type assertion and handling for job.Message in Queue's run method
  • Import job package in ring.go
  • Add Data struct with Payload field and Bytes method in ring.go
  • Update Ring's Run method to use Data struct for task handling

- Remove `Encode` method call in `BenchmarkQueue` function
- Add `TaskMessage` interface extending `QueuedMessage` with `Payload` method
- Rename `Payload` field to `Body` in `Message` struct
- Add `Payload` method to `Message` struct to return `Body`
- Replace `Data` field and `Encode` method in `Message` struct with `Bytes` method using JSON marshalling
- Update `NewMessage` to use `Body` instead of `Payload`
- Add documentation for `Encode` method in `job` package
- Update `TestMessageEncodeDecode` to use `Payload()` method
- Replace `Encode` method call with direct handling of `task` in `Queue` methods
- Change logger from `Errorf` to `Fatalf` in `Queue` error handling
- Add type assertion and handling for `job.Message` in `Queue`'s `run` method
- Import `job` package in `ring.go`
- Add `Data` struct with `Payload` field and `Bytes` method in `ring.go`
- Update `Ring`'s `Run` method to use `Data` struct for task handling

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
@appleboy appleboy merged commit cc471ea into master Jan 20, 2025
5 checks passed
@appleboy appleboy deleted the task branch January 20, 2025 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant