Skip to content

Commit a1dd990

Browse files
committed
fix(api): subscribe before namespace workflow dispatch
1 parent 0e297a0 commit a1dd990

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

engine/packages/api-peer/src/namespaces.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,6 @@ pub async fn create(
9797
) -> Result<CreateResponse> {
9898
let namespace_id = Id::new_v1(ctx.config().dc_label());
9999

100-
ctx.workflow(namespace::workflows::namespace::Input {
101-
namespace_id,
102-
name: body.name.clone(),
103-
display_name: body.display_name.clone(),
104-
})
105-
.tag("namespace_id", namespace_id)
106-
.dispatch()
107-
.await?;
108-
109100
let mut create_sub = ctx
110101
.subscribe::<namespace::workflows::namespace::CreateComplete>((
111102
"namespace_id",
@@ -116,6 +107,15 @@ pub async fn create(
116107
.subscribe::<namespace::workflows::namespace::Failed>(("namespace_id", namespace_id))
117108
.await?;
118109

110+
ctx.workflow(namespace::workflows::namespace::Input {
111+
namespace_id,
112+
name: body.name.clone(),
113+
display_name: body.display_name.clone(),
114+
})
115+
.tag("namespace_id", namespace_id)
116+
.dispatch()
117+
.await?;
118+
119119
tokio::select! {
120120
res = create_sub.next() => { res?; },
121121
res = fail_sub.next() => {

0 commit comments

Comments
 (0)