@@ -39,68 +39,23 @@ async fn fdb_sqlite_nats_driver() {
3939 // .await
4040 // .unwrap();
4141
42- // let res = db
43- // .find_workflow(
44- // "workflow_name",
45- // &json!({
46- // "bald": "eagle",
47- // "fat": "man"
48- // }),
49- // )
50- // .await
51- // .unwrap();
52- // tracing::info!(?res);
53-
54- // db.update_workflow_tags(
55- // workflow_id,
56- // "workflow_name",
57- // &json!({
58- // "bald": "eagle",
59- // "fat": "man"
60- // }),
61- // )
62- // .await
63- // .unwrap();
42+ let workflow_id = ctx. workflow ( def:: Input { } )
43+ . dispatch ( )
44+ . await
45+ . unwrap ( ) ;
6446
65- // let res = db
66- // .find_workflow(
67- // "workflow_name",
68- // &json!({
69- // "bald": "eagle",
70- // "fat": "man"
71- // }),
72- // )
73- // .await
74- // .unwrap();
75- // tracing::info!(?res);
76-
77- if std:: env:: var ( "SPAWN_WF" ) . unwrap_or_default ( ) == "1" {
78- for _ in 0 ..1 {
79- let ctx2 = ctx. clone ( ) ;
80- tokio:: spawn ( async move {
81- ctx2. workflow ( def:: Input { } )
82- . tag ( "foo" , "bar" )
83- . dispatch ( )
84- . await
85- . unwrap ( ) ;
86- } ) ;
87- }
88- }
47+ let ctx2 = ctx. clone ( ) ;
48+ tokio:: spawn ( async move {
49+ tokio:: time:: sleep ( Duration :: from_millis ( 110 ) ) . await ;
8950
90- // let ctx2 = ctx.clone();
91- // tokio::spawn(async move {
92- // for _ in 0..10 {
93- // tokio::time::sleep(Duration::from_secs(2)).await;
94- // ctx2.signal(def::MySignal {
95- // test: Uuid::new_v4(),
96- // })
97- // .to_workflow::<def::Workflow>()
98- // .tag("foo", "bar")
99- // .send()
100- // .await
101- // .unwrap();
102- // }
103- // });
51+ ctx2. signal ( def:: MySignal {
52+ test : Uuid :: new_v4 ( ) ,
53+ } )
54+ . to_workflow_id ( workflow_id)
55+ . send ( )
56+ . await
57+ . unwrap ( ) ;
58+ } ) ;
10459
10560 let worker = Worker :: new ( reg. clone ( ) , db. clone ( ) ) ;
10661
@@ -120,43 +75,14 @@ mod def {
12075 pub async fn test ( ctx : & mut WorkflowCtx , input : & Input ) -> GlobalResult < ( ) > {
12176 tracing:: info!( w=?ctx. workflow_id( ) , "hello from workflow" ) ;
12277
123- ctx. activity ( TestActivityInput {
124- foo : "bar" . to_string ( ) ,
125- } )
126- . await ?;
127-
128- // let workflow_id = ctx.workflow_id();
129- // ctx.signal(MySignal {
130- // test: Uuid::new_v4(),
78+ // ctx.activity(TestActivityInput {
79+ // foo: "bar".to_string(),
13180 // })
132- // .to_workflow_id(workflow_id)
133- // .send()
13481 // .await?;
13582
136- ctx. repeat ( |ctx| {
137- async move {
138- let sig = ctx. listen_with_timeout :: < MySignal > ( 5 * 1000 ) . await ?;
139- tracing:: info!( ?sig) ;
140-
141- let start = std:: time:: Instant :: now ( ) ;
142-
143- ctx. activity ( TestActivityInput {
144- foo : "bar" . to_string ( ) ,
145- } )
146- . await ?;
83+ let sig = ctx. listen :: < MySignal > ( ) . await ?;
14784
148- ctx. activity ( TestActivityInput {
149- foo : "bar" . to_string ( ) ,
150- } )
151- . await ?;
152-
153- tracing:: info!( dt=?start. elapsed( ) , "-------------" ) ;
154-
155- Ok ( Loop :: < ( ) > :: Continue )
156- }
157- . boxed ( )
158- } )
159- . await ?;
85+ tracing:: info!( ?sig, "signal recv ------------------" ) ;
16086
16187 Ok ( ( ) )
16288 }
0 commit comments