Repository navigation
perf(macos): stop idle polling and repeated work in SSH accept, MCP, themes, linked folders, dashboard, SFTP, Snowflake and sync - #4229
Merged
Conversation
…themes, linked folders, dashboard, SFTP, Snowflake and sync
datlechin
enabled auto-merge (squash)
November 12, 2026 06:15
datlechin
added a commit
that referenced
this pull request
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Idle wakeups, polling and repeated work from the 2026-11-11 performance audit (lane idle-network).
DispatchSourceon the listening socket replaces the 200 mspollloop inLibSSH2Tunnel,RemoteSQLiteTunneland the iOSSSHTunnel. The listening socket closes only after the source's cancel handler ran. Measured: 4.4 wakeups/s per tunnel before, 0 after (baseline 0.1/s), and no thread parked inpoll.schemaChangeToken()(defaultnil, kit stays 44). SQLite answersPRAGMA main.schema_version. A write to the file reloads the catalog only when the token moved; a write that changes rows reloads nothing. The reload usesrefreshAfterWriteand reports whether it committed, so a failed reload is retried on the next write.git rev-parse, so a repository made in a parent folder is found. A.gitignoreedit or a new.gitin the folder refreshes the badges.NSWindow.occlusionState, and runs a pass when it shows again. Unchanged sessions, metrics, slow queries and errors no longer publish. Before: 3 catalog queries every 5 s while hidden (2,160/hour). After: 0.sftp_read,max_read_ahead = buffer_size * 4), so 32 KiB capped a download at 128 KiB per round trip.apple/scripts/probes/check-sftp-read-ahead.sh, 32 MB file, +50 ms round trip: 2.3 MB/s before, 19.8 MB/s after.URLSessions. The sessions live in an owner that invalidates them when the last request lets go. The server version is read once per shared session: 1SELECT CURRENT_VERSION()per pooled driver before, 0 after the first.didBecomeActiveNotificationnow reload or watch the folder (ThemeCatalogTests,ThemeEngineTests,ThemeCatalogSyncTests);SSHTunnelDeadlineMarginTests.acceptPollIsShortis gone with the poll.Needs the maintainer
SyncCoordinator.activationInterval). Push-driven sync (CKDatabaseSubscription) needs theaps-environmententitlement on the App ID, which the app does not have.Test plan
SyncCoordinatorActivationTests(an activation during the launch run adds no second download; held activations run once when the interval ends; a queued edit is not held),SchemaChangeTokenGateTests,SchemaRefreshAfterWriteTests.refreshAfterWriteReportsWhetherItCommitted,SQLiteSchemaChangeTokenTests,MCPServerClientListTests,ServerDashboardViewModelTests(hidden window stops polling),LinkedSQLFolderScannerTests,SQLFolderWatcherTests,FileSystemEventWatcherTests,LinkedFolderGitStatusStoreTests,SFTPDownloadChunkSizeTests,SSHListenerAcceptorTests.SQLiteSchemaChangeTokenTests,SSHListenerAcceptorTests(5) underswift test,verify.sh pluginsandabi(changed, kit 44, minimum 19).verify.sh ioswas inconclusive: no iOS simulator runtime on this Mac, so the iOS job in CI is the check for the iOSSSHTunnelchange.check-sftp-read-ahead.shfor NET-05; aproc_pid_rusagewakeup count of a 200 mspollloop against aDispatchSourceon a listening socket for CPU-06.