-
Notifications
You must be signed in to change notification settings - Fork 223
perf: add Worker Thread for non-blocking session parsing #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f5dcbfd
e9f3b36
213ba21
aa1df1e
09fb97f
b315a64
c951a19
c322cc4
b9affb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,7 @@ import { join } from 'path'; | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| import { initializeIpcHandlers, removeIpcHandlers } from './ipc/handlers'; | ||||||||||||||||||||||
| import { getProjectsBasePath, getTodosBasePath } from './utils/pathDecoder'; | ||||||||||||||||||||||
| import { sessionParserPool } from './workers/SessionParserPool'; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Window icon path for non-mac platforms. | ||||||||||||||||||||||
| const getWindowIconPath = (): string | undefined => { | ||||||||||||||||||||||
|
|
@@ -400,6 +401,9 @@ function shutdownServices(): void { | |||||||||||||||||||||
| sshConnectionManager.dispose(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Terminate worker pool | ||||||||||||||||||||||
| sessionParserPool.terminate(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Remove IPC handlers | ||||||||||||||||||||||
| removeIpcHandlers(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -481,12 +485,21 @@ function createWindow(): void { | |||||||||||||||||||||
| const ZOOM_OUT_KEYS = new Set(['-', '_']); | ||||||||||||||||||||||
| mainWindow.webContents.on('before-input-event', (event, input) => { | ||||||||||||||||||||||
| if (!mainWindow || mainWindow.isDestroyed()) return; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if (input.type !== 'keyDown') return; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Prevent Electron's default Ctrl+R / Cmd+R page reload so the renderer | ||||||||||||||||||||||
| // keyboard handler can use it as "Refresh Session" (fixes #58). | ||||||||||||||||||||||
| // Also prevent Ctrl+Shift+R / Cmd+Shift+R (hard reload). | ||||||||||||||||||||||
| if ((input.control || input.meta) && input.key.toLowerCase() === 'r') { | ||||||||||||||||||||||
| // Intercept Ctrl+R / Cmd+R to prevent Chromium's built-in page reload, | ||||||||||||||||||||||
| // then notify the renderer via IPC so it can refresh the session (fixes #58, #85). | ||||||||||||||||||||||
| // We must preventDefault here because Chromium handles Ctrl+R at the browser | ||||||||||||||||||||||
| // engine level, which also blocks the keydown from reaching the renderer — | ||||||||||||||||||||||
| // hence the IPC bridge. | ||||||||||||||||||||||
| if ((input.control || input.meta) && !input.shift && input.key.toLowerCase() === 'r') { | ||||||||||||||||||||||
| event.preventDefault(); | ||||||||||||||||||||||
| mainWindow.webContents.send('session:refresh'); | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+496
to
+500
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Use the Line 498 uses the hardcoded string ♻️ Proposed fixImport the constant at the top of the file (around line 48 where other IPC constants are duplicated): const SSH_STATUS = 'ssh:status';
const CONTEXT_CHANGED = 'context:changed';
+const SESSION_REFRESH = 'session:refresh';Then use it in the handler: if ((input.control || input.meta) && !input.shift && input.key.toLowerCase() === 'r') {
event.preventDefault();
- mainWindow.webContents.send('session:refresh');
+ mainWindow.webContents.send(SESSION_REFRESH);
return;
}Based on learnings: "IPC channel constants must be defined in 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| // Also block Ctrl+Shift+R (hard reload) | ||||||||||||||||||||||
| if ((input.control || input.meta) && input.shift && input.key.toLowerCase() === 'r') { | ||||||||||||||||||||||
| event.preventDefault(); | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: matt1398/claude-devtools
Length of output: 307
Remove or explain the unused 'claude-devtools-native' exemption.
Verification confirms this exemption is never triggered. The string
'claude-devtools-native'appears only in the exemption check itself and is not imported or required anywhere in the codebase or referenced in package.json. The actual native module loading occurs at runtime via dynamicrequire(candidate)with filesystem paths, which bypass this vite plugin entirely. This check appears to be dead code and should be removed unless it's intentionally reserved for future use (in which case, add a clarifying comment).🤖 Prompt for AI Agents