diff --git a/config/system-user-dev.json b/config/system-user-dev.json index 458bf58..312a799 100644 --- a/config/system-user-dev.json +++ b/config/system-user-dev.json @@ -1,8 +1,8 @@ { "email": "system@system.com", "name": "admin", - "password": "McHlnXLpayjhShkPjIGx", + "password": "SyP9YCFkgxu2FPNxFI8W", "type": "admin", - "id": "68a73ee8bc7d1e022691048a", - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY4YTczZWU4YmM3ZDFlMDIyNjkxMDQ4YSIsImlhdCI6MTc1NTc5MTA4MH0.ahqw8ywrhtQ8Sz9QY42AZ267hOd0n2Y_gzZCbv91N8I" + "id": "68d47521e6060ba7332301b1", + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY4ZDQ3NTIxZTYwNjBiYTczMzIzMDFiMSIsImlhdCI6MTc1OTE3NjQ3Mn0.pGJh_Io1_aZ3IwWdzOnC5Bt9Nw0x4MRhAAp7RkZrtmA" } \ No newline at end of file diff --git a/config/system-user-test.json b/config/system-user-test.json index 7c96ad5..0603a51 100644 --- a/config/system-user-test.json +++ b/config/system-user-test.json @@ -1,6 +1,8 @@ { - "password": "RCJqq5FjgYzvTXOyS1vo", "email": "system@system.com", - "id": "645e59c19d49119bbb8329e7", - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0NWU1OWMxOWQ0OTExOWJiYjgzMjllNyIsImlhdCI6MTY4MzkwNDk2MX0.2yi-hkY31nkgMm_S1QrPs4dIm5DBnJ4GsJEPiSPYHDA" + "name": "admin", + "password": "UdbCjMgm7T8efeyUfcdN", + "type": "admin", + "id": "68daea62e9b47af49f86dae9", + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY4ZGFlYTYyZTliNDdhZjQ5Zjg2ZGFlOSIsImlhdCI6MTc1OTE3NzMxNH0.-mFCzyDri0OLMz-oM03qyYPj7srEH_6HFLGzgCf_JLI" } \ No newline at end of file diff --git a/src/controllers/timer-controllers.js b/src/controllers/timer-controllers.js index 320292f..4e85959 100644 --- a/src/controllers/timer-controllers.js +++ b/src/controllers/timer-controllers.js @@ -26,6 +26,7 @@ class TimerControllers { // Constants this.cleanUsageInterval = 60000 * 60 // 1 hour this.backupUsageInterval = 60000 * 10 // 10 minutes + this.rebootInterval = 60000 * 60 * 12 // 12 hours // Encapsulate dependencies this.config = config @@ -33,6 +34,7 @@ class TimerControllers { // Bind 'this' object to all subfunctions. this.cleanUsage = this.cleanUsage.bind(this) this.backupUsage = this.backupUsage.bind(this) + this.autoReboot = this.autoReboot.bind(this) } // Start all the time-based controllers. @@ -42,6 +44,11 @@ class TimerControllers { this.cleanUsageHandle = setInterval(this.cleanUsage, this.cleanUsageInterval) this.backupUsageHandle = setInterval(this.backupUsage, this.backupUsageInterval) + // Periodically reboot this app. Helia has a slight memory leak, and occasionally + // runs into unrecoverable network issues. Rebooting is one way to overcome these + // black-box issues. + this.rebootHandle = setInterval(this.autoReboot, this.rebootInterval) + return true } @@ -98,6 +105,15 @@ class TimerControllers { return false } } + + // This timer is used to auto-reboot the processes. If this is being run in Docker container + // (the target for production), the Docker container should automatically restart the timer. + // This is a temporary fix to the IPFS node stalling occasionally until a better fix can be + // found. + autoReboot () { + console.log('Rebooting service.') + process.exit(1) + } } export default TimerControllers