mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-18 11:33:23 +03:00
Improve asynchronous filesystem event processing
- queue and batch filesystem model updates on the main thread - process directory-tree updates and worker-affine listeners asynchronously - coalesce adjacent modified events for the same path - preserve captured file metadata across delayed event delivery - add event, path, and thread-affinity filters for listener subscriptions - configure optimized per-plugin filesystem subscriptions - make listener removal wait for active callbacks safely - handle self-removal without deadlocking - support allocation-free matching of moved source paths - synchronize project directory-tree mutations with active searches - centralize diff-view button visibility around find/replace state - improve code editor wrap-content and scrollbar sizing - add queue, listener, and filesystem-model regression tests
This commit is contained in:
@@ -5059,12 +5059,16 @@ void App::init( InitParameters& params ) {
|
||||
mFileWatcher->addWatch( mPidPath, mFileSystemListener );
|
||||
mFileWatcher->watch();
|
||||
mPluginManager->setFileSystemListener( mFileSystemListener );
|
||||
mIpcListenerId =
|
||||
mFileSystemListener->addListener( [this]( const FileEvent& fe, const FileInfo& fi ) {
|
||||
if ( !( ( fe.type == FileSystemEventType::Add ||
|
||||
fe.type == FileSystemEventType::Modified ) &&
|
||||
fe.directory == mPidPath ) )
|
||||
return;
|
||||
FileSystemListener::ListenerOptions ipcListenerOptions;
|
||||
FileSystemListenerFilter ipcListenerFilter;
|
||||
ipcListenerFilter.eventTypes =
|
||||
FileSystemListener::eventTypeMask( FileSystemEventType::Add ) |
|
||||
FileSystemListener::eventTypeMask( FileSystemEventType::Modified );
|
||||
ipcListenerFilter.path = mPidPath;
|
||||
ipcListenerOptions.filters.emplace_back( std::move( ipcListenerFilter ) );
|
||||
ipcListenerOptions.affinity = FileSystemListener::ThreadAffinity::Worker;
|
||||
mIpcListenerId = mFileSystemListener->addListener(
|
||||
[this]( const FileEvent&, const FileInfo& fi ) {
|
||||
std::string path;
|
||||
FileSystem::fileGet( fi.getFilepath(), path );
|
||||
String::trimInPlace( path, ' ' );
|
||||
@@ -5091,7 +5095,8 @@ void App::init( InitParameters& params ) {
|
||||
} );
|
||||
}
|
||||
FileSystem::fileRemove( fi.getFilepath() );
|
||||
} );
|
||||
},
|
||||
std::move( ipcListenerOptions ) );
|
||||
#endif
|
||||
|
||||
mNotificationCenter = std::make_unique<NotificationCenter>(
|
||||
|
||||
Reference in New Issue
Block a user