@@ -230,7 +230,7 @@ impl Event {
230230 // schema is then enforced on rest of the events sent to this log stream.
231231 fn process_first_event < S : ObjectStorage , R : std:: io:: Read > (
232232 & self ,
233- mut event : json:: Reader < R > ,
233+ event : json:: Reader < R > ,
234234 schema : Schema ,
235235 ) -> Result < ( ) , EventError > {
236236 // note for functions _schema_with_map and _set_schema_with_map,
@@ -256,8 +256,7 @@ impl Event {
256256
257257 // Store record batch on local cache
258258 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) ?;
261260
262261 log:: info!( "schema is set in memory map for logstream {}" , stream_name) ;
263262 _set_schema_with_map ( stream_name, schema. clone ( ) , & mut stream_metadata) ;
@@ -298,10 +297,7 @@ impl Event {
298297 mut event : json:: Reader < R > ,
299298 ) -> Result < ( ) , EventError > {
300299 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) ?;
305301 Ok ( ( ) )
306302 }
307303
0 commit comments