@@ -122,11 +122,9 @@ export class RuntimeContext extends EventEmitter {
122122 }
123123 }
124124
125- if ( this . runtime . debug ) {
126- await this . _cacheConnector
127- . requester ( AccessCandidate . agent ( this . runtime . agent . id ) )
128- . set ( this . ctxFile , JSON . stringify ( ctxData ) , null , null , 1 * 60 * 60 ) ; //expires in 1 hour
129- }
125+ await this . _cacheConnector
126+ . requester ( AccessCandidate . agent ( this . runtime . agent . id ) )
127+ . set ( this . ctxFile , JSON . stringify ( ctxData ) , null , null , 1 * 60 * 60 ) ; //expires in 1 hour
130128 } else {
131129 ctxData = JSON . parse ( data ) ;
132130 if ( ! ctxData . step ) ctxData . step = 0 ;
@@ -143,7 +141,7 @@ export class RuntimeContext extends EventEmitter {
143141 return this . _readyPromise ;
144142 }
145143 private async sync ( ) {
146- if ( ! this . ctxFile || this . runtime . debug ) return ;
144+ if ( ! this . ctxFile ) return ;
147145
148146 this . emit ( 'syncing' ) ;
149147
@@ -162,11 +160,14 @@ export class RuntimeContext extends EventEmitter {
162160 this . ctxFile = null ;
163161 }
164162 } else {
163+ //TODO : Do we need to cache the context if not in debug mode ?
164+
165165 const data = this . serialize ( ) ;
166166 //if (data) fs.writeFileSync(this.ctxFile, JSON.stringify(data, null, 2));
167167 if ( data ) {
168168 let serializedData = JSON . stringify ( data ) ;
169169 console . debug ( 'Agent Context Size' , this . ctxFile , serializedData . length , AccessCandidate . agent ( this . runtime . agent . id ) ) ;
170+
170171 await this . _cacheConnector
171172 . requester ( AccessCandidate . agent ( this . runtime . agent . id ) )
172173 . set ( this . ctxFile , serializedData , null , null , 3 * 60 * 60 ) ; //expires in 3 hours max
0 commit comments