@@ -213,13 +213,30 @@ fn commit_schema(
213
213
. expect ( "map of schemas is serializable" ) ;
214
214
// try to put to storage
215
215
let storage = CONFIG . storage ( ) . get_object_store ( ) ;
216
- let res = futures:: executor:: block_on ( storage. put_schema_map ( stream_name, & schema_map) ) ;
216
+
217
+ let _stream_name = stream_name. to_owned ( ) ;
218
+ let handle = std:: thread:: spawn ( move || {
219
+ let rt = actix_web:: rt:: System :: new ( ) ;
220
+ rt. block_on ( storage. put_schema_map ( & _stream_name, & schema_map) )
221
+ } ) ;
222
+
223
+ let res = match handle. join ( ) {
224
+ Ok ( res) => res. map_err ( EventError :: ObjectStorage ) ,
225
+ Err ( _) => {
226
+ log:: error!( "commit schema thread panicked" ) ;
227
+ Err ( EventError :: InternalError )
228
+ }
229
+ } ;
217
230
// revert if err
218
- if res. is_err ( ) {
219
- stream_metadata. remove_unchecked ( stream_name, schema_key)
231
+ if let Err ( ref err) = res {
232
+ stream_metadata. remove_unchecked ( stream_name, schema_key) ;
233
+ log:: error!(
234
+ "Failed to commit schema during new event ingestion: {}" ,
235
+ err
236
+ )
220
237
}
221
- // return result
222
- res. map_err ( |err| err . into ( ) )
238
+
239
+ res
223
240
}
224
241
}
225
242
@@ -288,8 +305,10 @@ pub mod error {
288
305
Arrow ( #[ from] ArrowError ) ,
289
306
#[ error( "Schema Mismatch" ) ]
290
307
SchemaMismatch ,
291
- #[ error( "Schema Mismatch : {0}" ) ]
308
+ #[ error( "ObjectStorage Error : {0}" ) ]
292
309
ObjectStorage ( #[ from] ObjectStorageError ) ,
310
+ #[ error( "Internal Error" ) ]
311
+ InternalError ,
293
312
}
294
313
}
295
314
0 commit comments