Update lum la
This commit is contained in:
parent
13109dc75f
commit
7cfe8a1d69
|
|
@ -91,6 +91,7 @@ Soi các nguy cơ:
|
||||||
- Redis state (`socket_state`, `station:{id}:line:{id}:history`): khi thêm field mới, `saveState` / `restoreState` có cover không.
|
- Redis state (`socket_state`, `station:{id}:line:{id}:history`): khi thêm field mới, `saveState` / `restoreState` có cover không.
|
||||||
- Idle-timeout (`setTimeoutConnect`, 8h) **và** keep-alive (`keepConnectAPC` 40s / `keepConnectStation` 120s) có được wire đầy đủ cho connection mới không (theo CLAUDE.md).
|
- Idle-timeout (`setTimeoutConnect`, 8h) **và** keep-alive (`keepConnectAPC` 40s / `keepConnectStation` 120s) có được wire đầy đủ cho connection mới không (theo CLAUDE.md).
|
||||||
- Socket event mới: cả hai phía FE/BE có khớp tên + payload shape không.
|
- Socket event mới: cả hai phía FE/BE có khớp tên + payload shape không.
|
||||||
|
- Ghi ngắn gọn nội dung
|
||||||
|
|
||||||
#### 4.3. Performance
|
#### 4.3. Performance
|
||||||
|
|
||||||
|
|
@ -99,13 +100,7 @@ Soi các nguy cơ:
|
||||||
- Re-render React thừa (`App.tsx` đang dùng `lineBuffersRef` + flush 50ms — diff mới có phá vỡ pattern này không).
|
- Re-render React thừa (`App.tsx` đang dùng `lineBuffersRef` + flush 50ms — diff mới có phá vỡ pattern này không).
|
||||||
- Bộ nhớ giữ output dài (truncate ở `saveState` 5000 chars — diff mới có giữ thêm field nặng không).
|
- Bộ nhớ giữ output dài (truncate ở `saveState` 5000 chars — diff mới có giữ thêm field nặng không).
|
||||||
- Setinterval/setTimeout có dồn (leak) không.
|
- Setinterval/setTimeout có dồn (leak) không.
|
||||||
|
- Ghi ngắn gọn nội dung
|
||||||
#### 4.4. Consistency
|
|
||||||
|
|
||||||
Hai gạch đầu dòng phụ:
|
|
||||||
|
|
||||||
- **Đúng `CLAUDE.md`?** Đối chiếu từng quy ước liên quan: subpath imports `#controllers/*` (không phải relative trừ file ngoài `app/`), folder names `ultils`/`untils` (không rename), VN/EN comment language giữ nguyên, hot-reload boundaries, idle/keep-alive paired, `saveState`/`restoreState` extend khi thêm state.
|
|
||||||
- **Đúng coding standard?** ESLint flat config / Prettier / TS strict / naming convention (camelCase biến, PascalCase component, `T*` prefix cho type ở FE). Đặt tên file/component có nhất quán không. Comment có ý nghĩa, không lặp lại code.
|
|
||||||
|
|
||||||
#### 4.5. Simplicity
|
#### 4.5. Simplicity
|
||||||
|
|
||||||
|
|
@ -113,6 +108,7 @@ Hai gạch đầu dòng phụ:
|
||||||
- Có over-engineering, abstraction sớm.
|
- Có over-engineering, abstraction sớm.
|
||||||
- Có thể gộp branch / sớm return để giảm nesting.
|
- Có thể gộp branch / sớm return để giảm nesting.
|
||||||
- Đề xuất cụ thể cách rút gọn (mỗi đề xuất kèm trước/sau ngắn nếu hữu ích).
|
- Đề xuất cụ thể cách rút gọn (mỗi đề xuất kèm trước/sau ngắn nếu hữu ích).
|
||||||
|
- Ghi ngắn gọn nội dung
|
||||||
|
|
||||||
### 5. Trả về kết quả
|
### 5. Trả về kết quả
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,8 +142,8 @@ export default class LogsController {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lấy 100 tên file đầu tiên từ danh sách lọc được
|
// Lấy 100 tên file mới nhất (cuối danh sách)
|
||||||
const result = files.slice(0, 100)
|
const result = files.slice(-100)
|
||||||
|
|
||||||
return response.ok({
|
return response.ok({
|
||||||
status: true,
|
status: true,
|
||||||
|
|
|
||||||
|
|
@ -582,7 +582,7 @@ export default class LineConnection {
|
||||||
? { ...this.config.inventory, ...dataInventory, listInventory }
|
? { ...this.config.inventory, ...dataInventory, listInventory }
|
||||||
: { ...dataInventory, listInventory }
|
: { ...dataInventory, listInventory }
|
||||||
pid = dataInventory?.pid || ''
|
pid = dataInventory?.pid || ''
|
||||||
this.addHistory(this.config.stationId, this.config.id, {
|
await this.addHistory(this.config.stationId, this.config.id, {
|
||||||
id: this.config.id,
|
id: this.config.id,
|
||||||
number: this.config.lineNumber,
|
number: this.config.lineNumber,
|
||||||
stationId: this.config.stationId,
|
stationId: this.config.stationId,
|
||||||
|
|
@ -655,7 +655,7 @@ export default class LineConnection {
|
||||||
},
|
},
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
this.addHistory(
|
await this.addHistory(
|
||||||
this.config.stationId,
|
this.config.stationId,
|
||||||
this.config.id,
|
this.config.id,
|
||||||
{
|
{
|
||||||
|
|
@ -2616,7 +2616,7 @@ Ports Missing/Down: ${missing.length}\n\n`
|
||||||
console.error(`Failed to save report for SN ${reportSN}:`, err)
|
console.error(`Failed to save report for SN ${reportSN}:`, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.addHistory(
|
await this.addHistory(
|
||||||
this.config.stationId,
|
this.config.stationId,
|
||||||
this.config.id,
|
this.config.id,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ const parseLog = (data: string) => {
|
||||||
Object.keys(currentRecord).forEach((key) => {
|
Object.keys(currentRecord).forEach((key) => {
|
||||||
if (item && item[key] !== undefined) {
|
if (item && item[key] !== undefined) {
|
||||||
if (key === "pid") {
|
if (key === "pid") {
|
||||||
item[key] = item[key].replace("(", '').replace(")", '')
|
item[key] = item[key].replace(/[()]/g, '')
|
||||||
}
|
}
|
||||||
currentRecord[key] = item[key].trim()
|
currentRecord[key] = item[key].trim()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,7 @@ function DrawerLogs({
|
||||||
}, [testLogContent]);
|
}, [testLogContent]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!opened) return;
|
||||||
// Clear previous debounce timer
|
// Clear previous debounce timer
|
||||||
if (debounceTimerRef.current) {
|
if (debounceTimerRef.current) {
|
||||||
clearTimeout(debounceTimerRef.current);
|
clearTimeout(debounceTimerRef.current);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue