Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
msegzda committed Feb 5, 2025
1 parent 6f55ac6 commit d8215d7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
2 changes: 1 addition & 1 deletion config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
"minPriciestMargin": {
"title": "Minimum Price Threshold for Priciest Hour(s)",
"description": "Hours below this price will not be included into 'priciest hours(s)' calculation. Default 0 cents.",
"description": "Hours below this price will not be included into 'priciest hours(s)' calculation. Default 0 (cents).",
"required": false,
"default": 0,
"minimum": 0,
Expand Down
21 changes: 0 additions & 21 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,27 +120,6 @@ export function defaultPricesCache(api: API, log: Logging) {
files.filter(file => file.startsWith(`${nsHash}-`)).forEach(file => {
const filePath = Path.join(cacheDirectory, file);

try {
// Attempt to make file writable if needed
fs.accessSync(filePath, fs.constants.W_OK);
} catch (error: unknown) {
if (error instanceof Error) {
log.warn(`File not writable, attempting to change permissions for: ${filePath}`);
try {
fs.chmodSync(filePath, 0o666); // Best-effort for UNIX-like systems
log.debug(`OK: Permissions changed to 0666 for: ${filePath}`);
} catch (chmodError: unknown) {
if (chmodError instanceof Error) {
log.warn(`Failed to change permissions for file: ${filePath}. Error: ${chmodError.message}`);
} else {
log.warn(`Failed to change permissions for file: ${filePath}. Unknown error`);
}
}
} else {
log.warn(`File not writable, unknown error while checking permissions for: ${filePath}`);
}
}

try {
const stats = fs.statSync(filePath);
const fileAge = now - stats.mtimeMs;
Expand Down

0 comments on commit d8215d7

Please sign in to comment.