2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-10-22 22:06:12 +08:00

Use protobuf to encode task message

This commit is contained in:
Ken Hibino
2021-03-01 21:33:36 -08:00
parent 47543b36fd
commit 4046932fde
7 changed files with 60 additions and 23 deletions

View File

@@ -34,8 +34,8 @@ type TaskMessage struct {
Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`
Queue string `protobuf:"bytes,4,opt,name=queue,proto3" json:"queue,omitempty"`
Retry string `protobuf:"bytes,5,opt,name=retry,proto3" json:"retry,omitempty"`
Retried string `protobuf:"bytes,6,opt,name=retried,proto3" json:"retried,omitempty"`
Retry int32 `protobuf:"varint,5,opt,name=retry,proto3" json:"retry,omitempty"`
Retried int32 `protobuf:"varint,6,opt,name=retried,proto3" json:"retried,omitempty"`
ErrorMsg string `protobuf:"bytes,7,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"`
Timeout int64 `protobuf:"varint,8,opt,name=timeout,proto3" json:"timeout,omitempty"`
Deadline int64 `protobuf:"varint,9,opt,name=deadline,proto3" json:"deadline,omitempty"`
@@ -102,18 +102,18 @@ func (x *TaskMessage) GetQueue() string {
return ""
}
func (x *TaskMessage) GetRetry() string {
func (x *TaskMessage) GetRetry() int32 {
if x != nil {
return x.Retry
}
return ""
return 0
}
func (x *TaskMessage) GetRetried() string {
func (x *TaskMessage) GetRetried() int32 {
if x != nil {
return x.Retried
}
return ""
return 0
}
func (x *TaskMessage) GetErrorMsg() string {
@@ -155,9 +155,9 @@ var file_asynq_proto_rawDesc = []byte{
0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, 0x04,
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72,
0x65, 0x74, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, 0x65, 0x74, 0x72,
0x65, 0x74, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x65, 0x74, 0x72,
0x79, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x65,
0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x65,
0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65,
0x6f, 0x75, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f,

View File

@@ -14,9 +14,9 @@ message TaskMessage {
string queue = 4;
string retry = 5;
int32 retry = 5;
string retried = 6;
int32 retried = 6;
string error_msg = 7;