File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ pub(crate) trait Proxy {
46
46
#[ name = "call" ]
47
47
async fn call ( req : Json < ProxyRequest > ) -> HandlerResult < Json < Vec < u8 > > > ;
48
48
#[ name = "oneWayCall" ]
49
- async fn one_way_call ( req : Json < ProxyRequest > ) -> HandlerResult < ( ) > ;
49
+ async fn one_way_call ( req : Json < ProxyRequest > ) -> HandlerResult < String > ;
50
50
#[ name = "manyCalls" ]
51
51
async fn many_calls ( req : Json < Vec < ManyCallRequest > > ) -> HandlerResult < ( ) > ;
52
52
}
@@ -70,16 +70,19 @@ impl Proxy for ProxyImpl {
70
70
& self ,
71
71
ctx : Context < ' _ > ,
72
72
Json ( req) : Json < ProxyRequest > ,
73
- ) -> HandlerResult < ( ) > {
73
+ ) -> HandlerResult < String > {
74
74
let request = ctx. request :: < _ , ( ) > ( req. to_target ( ) , req. message ) ;
75
75
76
- if let Some ( delay_millis) = req. delay_millis {
77
- request. send_after ( Duration :: from_millis ( delay_millis) ) ;
76
+ let invocation_id = if let Some ( delay_millis) = req. delay_millis {
77
+ request
78
+ . send_after ( Duration :: from_millis ( delay_millis) )
79
+ . invocation_id ( )
80
+ . await ?
78
81
} else {
79
- request. send ( ) ;
80
- }
82
+ request. send ( ) . invocation_id ( ) . await ?
83
+ } ;
81
84
82
- Ok ( ( ) )
85
+ Ok ( invocation_id )
83
86
}
84
87
85
88
async fn many_calls (
Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ pub(crate) trait TestUtilsService {
62
62
async fn count_executed_side_effects ( increments : u32 ) -> HandlerResult < u32 > ;
63
63
#[ name = "getEnvVariable" ]
64
64
async fn get_env_variable ( env : String ) -> HandlerResult < String > ;
65
+ #[ name = "cancelInvocation" ]
66
+ async fn cancel_invocation ( invocation_id : String ) -> Result < ( ) , TerminalError > ;
65
67
#[ name = "interpretCommands" ]
66
68
async fn interpret_commands ( req : Json < InterpretRequest > ) -> HandlerResult < ( ) > ;
67
69
}
@@ -155,6 +157,15 @@ impl TestUtilsService for TestUtilsServiceImpl {
155
157
Ok ( std:: env:: var ( env) . ok ( ) . unwrap_or_default ( ) )
156
158
}
157
159
160
+ async fn cancel_invocation (
161
+ & self ,
162
+ ctx : Context < ' _ > ,
163
+ invocation_id : String ,
164
+ ) -> Result < ( ) , TerminalError > {
165
+ ctx. invocation_handle ( invocation_id) . cancel ( ) . await ?;
166
+ Ok ( ( ) )
167
+ }
168
+
158
169
async fn interpret_commands (
159
170
& self ,
160
171
context : Context < ' _ > ,
You can’t perform that action at this time.
0 commit comments