@@ -152,10 +152,11 @@ export class ChatService extends Disposable implements IChatService {
152
152
if ( sessionData ) {
153
153
this . _persistedSessions = this . deserializeChats ( sessionData ) ;
154
154
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
+ }
156
158
} else {
157
159
this . _persistedSessions = { } ;
158
- this . trace ( 'constructor' , 'No persisted sessions' ) ;
159
160
}
160
161
161
162
this . _transferred = this . getTransferredSession ( ) ;
@@ -176,10 +177,16 @@ export class ChatService extends Disposable implements IChatService {
176
177
. filter ( session => session . requests . length ) ) ;
177
178
allSessions . sort ( ( a , b ) => ( b . creationDate ?? 0 ) - ( a . creationDate ?? 0 ) ) ;
178
179
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
+ }
180
183
181
184
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
+
183
190
this . storageService . store ( serializedChatKey , serialized , StorageScope . WORKSPACE , StorageTarget . MACHINE ) ;
184
191
}
185
192
0 commit comments