File tree Expand file tree Collapse file tree 1 file changed +24
-9
lines changed
Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -235,6 +235,15 @@ export class LoggingService {
235235 const until = since ? new Date ( since . until ) : undefined ;
236236
237237 const endStream = ( ) => {
238+ if ( oldestTimestamp ) {
239+ stream . emit (
240+ "data" ,
241+ JSON . stringify ( {
242+ oldest_timestamp : oldestTimestamp . toISOString ( ) ,
243+ } ) ,
244+ ) ;
245+ }
246+
238247 if ( ! streamEnded ) {
239248 streamEnded = true ;
240249 stream . end ( ) ;
@@ -304,17 +313,23 @@ export class LoggingService {
304313 for ( let data of text . split ( / \n / ) ) {
305314 const { timestamp, log } = this . parseLog ( data ) ;
306315
307- if ( since ) {
308- if ( new Date ( timestamp ) ) {
309- const latestTimestamp = new Date ( timestamp ) ;
310-
311- if ( ! oldestTimestamp || oldestTimestamp > latestTimestamp ) {
312- oldestTimestamp = latestTimestamp ;
316+ if ( new Date ( timestamp ) ) {
317+ const latestTimestamp = new Date ( timestamp ) ;
318+
319+ if ( ! oldestTimestamp || oldestTimestamp > latestTimestamp ) {
320+ if ( ! oldestTimestamp ) {
321+ stream . emit (
322+ "data" ,
323+ JSON . stringify ( {
324+ oldest_timestamp : latestTimestamp . toISOString ( ) ,
325+ } ) ,
326+ ) ;
313327 }
328+ oldestTimestamp = latestTimestamp ;
329+ }
314330
315- if ( latestTimestamp && latestTimestamp >= until ) {
316- continue ;
317- }
331+ if ( since && latestTimestamp && latestTimestamp >= until ) {
332+ continue ;
318333 }
319334 }
320335
You can’t perform that action at this time.
0 commit comments