a cache for slack profile pictures and emojis

feat: update the health check calculations

dunkirk.sh 02f0c124 d75cb6fc

verified
Changed files
+21 -6
.github
workflows
src
+1 -1
.github/workflows/deploy.yaml
···
- name: Health check
run: |
-
HEALTH_URL="http://ember:3000/health?detailed=true"
MAX_RETRIES=6
RETRY_DELAY=5
···
- name: Health check
run: |
+
HEALTH_URL="https://cachet.dunkirk.sh/health?detailed=true"
MAX_RETRIES=6
RETRY_DELAY=5
+20 -5
src/cache.ts
···
// Check memory usage
const memUsage = process.memoryUsage();
checks.memoryUsage = {
-
heapUsed: Math.round(memUsage.heapUsed / 1024 / 1024),
-
heapTotal: Math.round(memUsage.heapTotal / 1024 / 1024),
-
percentage: Math.round(
-
(memUsage.heapUsed / memUsage.heapTotal) * 100,
-
),
};
// Determine overall status
···
// Check memory usage
const memUsage = process.memoryUsage();
+
const bytesToMiB = (bytes: number) => bytes / 1024 / 1024;
+
+
const heapUsedMiB = bytesToMiB(memUsage.heapUsed);
+
const heapTotalMiB = bytesToMiB(memUsage.heapTotal);
+
const heapPercent = heapTotalMiB > 0 ? (heapUsedMiB / heapTotalMiB) * 100 : 0;
+
const rssMiB = bytesToMiB(memUsage.rss);
+
const externalMiB = bytesToMiB(memUsage.external || 0);
+
const arrayBuffersMiB = bytesToMiB(memUsage.arrayBuffers || 0);
+
checks.memoryUsage = {
+
heapUsed: Math.round(heapUsedMiB),
+
heapTotal: Math.round(heapTotalMiB),
+
percentage: Math.round(heapPercent),
+
details: {
+
heapUsedMiB: Number(heapUsedMiB.toFixed(2)),
+
heapTotalMiB: Number(heapTotalMiB.toFixed(2)),
+
heapPercent: Number(heapPercent.toFixed(2)),
+
rssMiB: Number(rssMiB.toFixed(2)),
+
externalMiB: Number(externalMiB.toFixed(2)),
+
arrayBuffersMiB: Number(arrayBuffersMiB.toFixed(2)),
+
},
};
// Determine overall status