mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-30 12:09:15 +00:00
refactor: update journal mode comment for DatabaseService and optimize CPU state check in EditorLayout
This commit is contained in:
@@ -47,8 +47,7 @@ export class DatabaseService {
|
|||||||
|
|
||||||
const dbPath = path.join(dataDir, 'sencho.db');
|
const dbPath = path.join(dataDir, 'sencho.db');
|
||||||
this.db = new Database(dbPath);
|
this.db = new Database(dbPath);
|
||||||
// Use WAL mode for better concurrency performance
|
// Default journal mode is safer for arbitrary Docker volume mounts than WAL
|
||||||
this.db.pragma('journal_mode = WAL');
|
|
||||||
|
|
||||||
this.initSchema();
|
this.initSchema();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,10 +197,16 @@ export default function EditorLayout() {
|
|||||||
|
|
||||||
const netIO = `${formatBytes(rxRate)}/s ↓ / ${formatBytes(txRate)}/s ↑`;
|
const netIO = `${formatBytes(rxRate)}/s ↓ / ${formatBytes(txRate)}/s ↑`;
|
||||||
|
|
||||||
|
// Check if values actually changed to prevent infinite re-renders
|
||||||
|
const newCpu = cpuPercent + '%';
|
||||||
|
if (prevStat && prevStat.cpu === newCpu && prevStat.ram === ramUsage && prevStat.lastRx === currentRx && prevStat.lastTx === currentTx) {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
[container.Id]: {
|
[container.Id]: {
|
||||||
cpu: cpuPercent + '%',
|
cpu: newCpu,
|
||||||
ram: ramUsage,
|
ram: ramUsage,
|
||||||
net: netIO,
|
net: netIO,
|
||||||
lastRx: currentRx,
|
lastRx: currentRx,
|
||||||
|
|||||||
Reference in New Issue
Block a user