File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ const path = require('path');
25
25
// const fs = require('fs');
26
26
27
27
console . log ( 'NODE ENV is ' , process . env . NODE_ENV ) ;
28
- const isDev = process . env . NODE_ENV === 'development' || process . env . NODE_ENV === 'test' ;
28
+ const isDev =
29
+ process . env . NODE_ENV === 'development' || process . env . NODE_ENV === 'test' ;
29
30
const port = 8080 ;
30
31
const selfHost = `http://localhost:${ port } ` ;
31
32
@@ -339,8 +340,12 @@ ipcMain.on('set_cookie', event => {
339
340
session . defaultSession . cookies
340
341
. get ( { url : serverUrl } )
341
342
. then ( cookie => {
342
- console . log ( cookie ) ;
343
- event . reply ( 'give_cookie' , cookie ) ;
343
+ // this if statement is necessary or the setInterval on main app will constantly run and will emit this event.reply, causing a memory leak
344
+ // checking for a cookie inside array will only emit reply when a cookie exists
345
+ if ( cookie [ 0 ] ) {
346
+ console . log ( cookie ) ;
347
+ event . reply ( 'give_cookie' , cookie ) ;
348
+ }
344
349
} )
345
350
. catch ( error => {
346
351
console . log ( 'Error giving cookies in set_cookie:' , error ) ;
You can’t perform that action at this time.
0 commit comments