@@ -106,14 +106,14 @@ impl Server {
106
106
107
107
let asyncio = py. import ( "asyncio" ) ?;
108
108
let event_loop = asyncio. call_method0 ( "new_event_loop" ) ?;
109
- asyncio. call_method1 ( "set_event_loop" , ( event_loop, ) ) ?;
109
+ asyncio. call_method1 ( "set_event_loop" , ( event_loop. clone ( ) , ) ) ?;
110
110
111
111
let startup_handler = self . startup_handler . clone ( ) ;
112
112
let shutdown_handler = self . shutdown_handler . clone ( ) ;
113
113
114
114
let excluded_response_headers_paths = self . excluded_response_headers_paths . clone ( ) ;
115
115
116
- let task_locals = pyo3_async_runtimes:: TaskLocals :: new ( event_loop) . copy_context ( py) ?;
116
+ let task_locals = pyo3_async_runtimes:: TaskLocals :: new ( event_loop. clone ( ) ) . copy_context ( py) ?;
117
117
let task_locals_copy = task_locals. clone_ref ( py) ;
118
118
119
119
let max_payload_size = env:: var ( MAX_PAYLOAD_SIZE )
@@ -136,7 +136,7 @@ impl Server {
136
136
HttpServer :: new ( move || {
137
137
let mut app = App :: new ( ) ;
138
138
139
- let task_locals = task_locals_copy. clone_ref ( py ) ;
139
+ let task_locals = task_locals_copy. clone ( ) ;
140
140
let directories = directories. read ( ) . unwrap ( ) ;
141
141
142
142
// this loop matches three types of directory serving
@@ -174,7 +174,7 @@ impl Server {
174
174
for ( elem, value) in ( web_socket_map. read ( ) ) . iter ( ) {
175
175
let endpoint = elem. clone ( ) ;
176
176
let path_params = value. clone ( ) ;
177
- let task_locals = task_locals. clone_ref ( py ) ;
177
+ let task_locals = task_locals. clone ( ) ;
178
178
app = app. route (
179
179
& endpoint. clone ( ) ,
180
180
web:: get ( ) . to ( move |stream : web:: Payload , req : HttpRequest | {
@@ -183,7 +183,7 @@ impl Server {
183
183
req,
184
184
stream,
185
185
path_params. clone ( ) ,
186
- task_locals. clone_ref ( py ) ,
186
+ task_locals. clone ( ) ,
187
187
endpoint_copy,
188
188
)
189
189
} ) ,
@@ -202,7 +202,7 @@ impl Server {
202
202
global_response_headers,
203
203
response_headers_exclude_paths,
204
204
req| {
205
- pyo3_async_runtimes:: tokio:: scope_local ( task_locals. clone_ref ( py ) , async move {
205
+ pyo3_async_runtimes:: tokio:: scope_local ( task_locals. clone ( ) , async move {
206
206
index (
207
207
router,
208
208
payload,
0 commit comments