Merge pull request #76 from Permissionless-Software-Foundation/ct-unstable

fix(reboot): Auto-reboot every 12 hours, to fix connectivity issues
This commit is contained in:
Chris Troutner
2025-09-29 13:24:21 -07:00
committed by GitHub
3 changed files with 24 additions and 6 deletions
+3 -3
View File
@@ -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"
}
+5 -3
View File
@@ -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"
}
+16
View File
@@ -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