mirror of
https://github.com/unraid/api.git
synced 2026-01-06 00:30:22 -06:00
On FAT32, `fs.stat()` updates accesstime, which means file reads are also writes, which means we can't use `usePoll` without degrading users' flash drives. To keep file reads lazy without a larger refactor, I override `getters.dynamix()` as the entrypoint to re-read the boot drive's dynamix config. Consecutive calls to `getters.dynamix()` are a common access pattern, which means we have to memoize to avoid many redundant file reads, so I used a TTL cache with a 250ms lifetime, hoping to scope config files to each request. `getters.dynamix()` is also used synchonously, so bit the bullet and switched away from async reads for simplicity, considering that most reads will be occurring from memory, even during cache misses. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a TTL memoized loader utility with exported types. * Added a public function to load Dynamix configuration at startup. * **Refactor** * Startup now uses the deterministic, cached config loader; runtime file-watch for Dynamix config removed. * Simplified config state handling and load-status reporting for more predictable startup behavior. * **Tests** * Added tests for TTL caching, eviction, keying, and conditional caching. * **Chores** * Bumped package versions and updated changelog. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
35 lines
839 B
JSON
35 lines
839 B
JSON
{
|
|
"name": "unraid-api-plugin-health",
|
|
"version": "4.25.3",
|
|
"main": "dist/index.js",
|
|
"type": "module",
|
|
"files": [
|
|
"dist"
|
|
],
|
|
"scripts": {
|
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
"build": "tsc",
|
|
"prepare": "npm run build"
|
|
},
|
|
"keywords": [],
|
|
"author": "Lime Technology, Inc. <unraid.net>",
|
|
"license": "GPL-2.0-or-later",
|
|
"description": "Example Health plugin for Unraid API",
|
|
"devDependencies": {
|
|
"@nestjs/common": "11.1.6",
|
|
"@nestjs/config": "4.0.2",
|
|
"@nestjs/core": "11.1.6",
|
|
"@nestjs/graphql": "13.1.0",
|
|
"nest-authz": "2.17.0",
|
|
"typescript": "5.9.2",
|
|
"pify": "6.1.0"
|
|
},
|
|
"peerDependencies": {
|
|
"@nestjs/common": "11.1.6",
|
|
"@nestjs/config": "4.0.2",
|
|
"@nestjs/core": "11.1.6",
|
|
"@nestjs/graphql": "13.1.0",
|
|
"nest-authz": "2.17.0"
|
|
}
|
|
}
|