@@ -230,7 +230,7 @@ impl Event {
230
230
// schema is then enforced on rest of the events sent to this log stream.
231
231
fn process_first_event < S : ObjectStorage , R : std:: io:: Read > (
232
232
& self ,
233
- mut event : json:: Reader < R > ,
233
+ event : json:: Reader < R > ,
234
234
schema : Schema ,
235
235
) -> Result < ( ) , EventError > {
236
236
// note for functions _schema_with_map and _set_schema_with_map,
@@ -256,8 +256,7 @@ impl Event {
256
256
257
257
// Store record batch on local cache
258
258
log:: info!( "creating local writer for this first event" ) ;
259
- let rb = event. next ( ) ?. ok_or ( EventError :: MissingRecord ) ?;
260
- STREAM_WRITERS :: append_to_local ( stream_name, & rb) ?;
259
+ self . process_event ( event) ?;
261
260
262
261
log:: info!( "schema is set in memory map for logstream {}" , stream_name) ;
263
262
_set_schema_with_map ( stream_name, schema. clone ( ) , & mut stream_metadata) ;
@@ -298,10 +297,7 @@ impl Event {
298
297
mut event : json:: Reader < R > ,
299
298
) -> Result < ( ) , EventError > {
300
299
let rb = event. next ( ) ?. ok_or ( EventError :: MissingRecord ) ?;
301
- let stream_name = & self . stream_name ;
302
-
303
- STREAM_WRITERS :: append_to_local ( stream_name, & rb) ?;
304
-
300
+ STREAM_WRITERS :: append_to_local ( & self . stream_name , & rb) ?;
305
301
Ok ( ( ) )
306
302
}
307
303
0 commit comments