Removed reply and error for general response.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
This commit is contained in:
parent
dce8434fb0
commit
a0ceacdd4f
@ -227,22 +227,6 @@ impl Message {
|
|||||||
action: action.into(),
|
action: action.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reply(&self, resp: Reply) -> Self {
|
|
||||||
Self {
|
|
||||||
msg_id: self.msg_id.clone(),
|
|
||||||
document_id: self.document_id.clone(),
|
|
||||||
action: MsgAction::Reply(resp),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn error(&self, err: MTTError) -> Self {
|
|
||||||
Self {
|
|
||||||
msg_id: self.msg_id.clone(),
|
|
||||||
document_id: self.document_id.clone(),
|
|
||||||
action: MsgAction::Error(err),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -311,7 +295,7 @@ mod messages {
|
|||||||
let name = "testing";
|
let name = "testing";
|
||||||
let msg = Message::new(name, MsgAction::Query(Query::new()));
|
let msg = Message::new(name, MsgAction::Query(Query::new()));
|
||||||
let responce = Reply::new();
|
let responce = Reply::new();
|
||||||
let reply = msg.reply(responce);
|
let reply = msg.response(responce);
|
||||||
assert_eq!(reply.get_message_id(), msg.get_message_id());
|
assert_eq!(reply.get_message_id(), msg.get_message_id());
|
||||||
match reply.get_document_id() {
|
match reply.get_document_id() {
|
||||||
NameID::Name(data) => assert_eq!(data, name),
|
NameID::Name(data) => assert_eq!(data, name),
|
||||||
@ -328,7 +312,7 @@ mod messages {
|
|||||||
let name = "testing";
|
let name = "testing";
|
||||||
let msg = Message::new(name, MsgAction::Query(Query::new()));
|
let msg = Message::new(name, MsgAction::Query(Query::new()));
|
||||||
let err_msg = Uuid::new_v4().to_string();
|
let err_msg = Uuid::new_v4().to_string();
|
||||||
let result = msg.error(MTTError::DocumentNotFound(err_msg.clone()));
|
let result = msg.response(MTTError::DocumentNotFound(err_msg.clone()));
|
||||||
|
|
||||||
assert_eq!(result.get_message_id(), msg.get_message_id());
|
assert_eq!(result.get_message_id(), msg.get_message_id());
|
||||||
match result.get_document_id() {
|
match result.get_document_id() {
|
||||||
@ -1633,7 +1617,7 @@ impl DocumentFile {
|
|||||||
match queue.register(tx, name, routes) {
|
match queue.register(tx, name, routes) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let error = msg.error(err);
|
let error = msg.response(err);
|
||||||
queue.send(error).unwrap();
|
queue.send(error).unwrap();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1647,7 +1631,7 @@ impl DocumentFile {
|
|||||||
spawn(move || {
|
spawn(move || {
|
||||||
doc.listen();
|
doc.listen();
|
||||||
});
|
});
|
||||||
let reply = msg.reply(Reply::new());
|
let reply = msg.response(Reply::new());
|
||||||
queue.send(reply).unwrap();
|
queue.send(reply).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user