Corrected external add document issue.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s

This commit is contained in:
2026-02-19 14:26:29 -05:00
parent d85bddaa34
commit 8c73798f95
9 changed files with 76 additions and 68 deletions

View File

@@ -106,7 +106,7 @@ mod createdocs {
fn create_document_creation() {
let doc_creator = TestCreateDoc::new();
let paths = [
Path::new(Include::All, Include::All, Include::Just(Action::Reply)),
Path::new(Include::All, Include::All, Include::Just(Action::DocumentCreated)),
Path::new(Include::All, Include::All, Include::Just(Action::Records)),
]
.to_vec();
@@ -124,7 +124,7 @@ mod createdocs {
rx
);
match result1.get_action() {
MsgAction::Reply(_) => {}
MsgAction::DocumentCreated => {}
_ => unreachable!("got {:?}: should have been a reply.", result1.get_action()),
}
let msg2 = Message::new(Query::new(name.clone()));
@@ -547,7 +547,7 @@ impl DocumentFile {
spawn(move || {
doc.listen();
});
let reply = msg.response(Reply::new(names[0].clone()));
let reply = msg.response(MsgAction::DocumentCreated);
queue.send(reply.clone());
}

View File

@@ -23,7 +23,7 @@ impl Session {
names
}
pub fn start(mut queue: Queue) {
pub fn document_definition() -> DocDef {
let mut docdef = DocDef::with_names(Self::doc_names());
let mut calc = Calculation::new(Operand::Add);
@@ -63,20 +63,6 @@ impl Session {
let delete_func = DocFuncType::Trigger(delete.into());
docdef.add_route(Clock::get_path(), delete_func);
let (tx, rx) = channel();
let sender_id = queue.add_sender(tx);
let msg = Message::new(docdef);
let msg_id = msg.get_message_id().clone();
let path = Path::new(
Include::Just(msg_id),
Include::All,
Include::Just(Action::Reply),
);
let reg_msg = Register::new(sender_id.clone(), RegMsg::AddRoute(path));
queue.send(msg.response(reg_msg));
rx.recv().unwrap();
queue.send(msg);
rx.recv().unwrap();
queue.remove_sender(&sender_id);
docdef
}
}