@@ -152,10 +152,11 @@ export class ChatService extends Disposable implements IChatService {
152152 if ( sessionData ) {
153153 this . _persistedSessions = this . deserializeChats ( sessionData ) ;
154154 const countsForLog = Object . keys ( this . _persistedSessions ) . length ;
155- this . trace ( 'constructor' , `Restored ${ countsForLog } persisted sessions` ) ;
155+ if ( countsForLog > 0 ) {
156+ this . trace ( 'constructor' , `Restored ${ countsForLog } persisted sessions` ) ;
157+ }
156158 } else {
157159 this . _persistedSessions = { } ;
158- this . trace ( 'constructor' , 'No persisted sessions' ) ;
159160 }
160161
161162 this . _transferred = this . getTransferredSession ( ) ;
@@ -176,10 +177,16 @@ export class ChatService extends Disposable implements IChatService {
176177 . filter ( session => session . requests . length ) ) ;
177178 allSessions . sort ( ( a , b ) => ( b . creationDate ?? 0 ) - ( a . creationDate ?? 0 ) ) ;
178179 allSessions = allSessions . slice ( 0 , maxPersistedSessions ) ;
179- this . trace ( 'onWillSaveState' , `Persisting ${ allSessions . length } sessions` ) ;
180+ if ( allSessions . length ) {
181+ this . trace ( 'onWillSaveState' , `Persisting ${ allSessions . length } sessions` ) ;
182+ }
180183
181184 const serialized = JSON . stringify ( allSessions ) ;
182- this . trace ( 'onWillSaveState' , `Persisting ${ serialized . length } chars` ) ;
185+
186+ if ( allSessions . length ) {
187+ this . trace ( 'onWillSaveState' , `Persisting ${ serialized . length } chars` ) ;
188+ }
189+
183190 this . storageService . store ( serializedChatKey , serialized , StorageScope . WORKSPACE , StorageTarget . MACHINE ) ;
184191 }
185192
0 commit comments