aonez / Keka

The macOS & iOS file archiver
https://www.keka.io
4.85k stars 240 forks source link

Multiple Keka Finder Extension processes #734

Open aonez opened 3 years ago

aonez commented 3 years ago

As stated by @cryptochrome at https://github.com/aonez/Keka/issues/709#issuecomment-737553190 and @Oleg-Chashko at https://github.com/aonez/Keka/issues/709#issuecomment-745932848 there might be multiple processes for the Finder Extension. Keka has no control of that process, macOS does.

As @pkamb wisely said and @gingerbeardman pointed:

This is expected behavior for macOS Finder Sync Extensions and not a bug or performance problem specific to Service Station.

MacOS may launch multiple copies of a Finder Extension in response to various actions in Finder.

Stated in Apple's references: https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/Finder.html

Performance Concerns

Finder Sync extensions may have a much longer lifespan than most other extensions. Because of this long lifespan, you must take particular care to avoid any possible performance issues. Ideally, Finder Sync extensions should spend most of their time running but idle. Limit the number of resources the extension consumes. Most important, be sure to avoid leaking any resources. Over time, even a small trickle can grow into a serious problem.

The system may also launch additional copies of your extension whenever an Open or Save dialog is displayed. This means that the user may have multiple copies of your extension running at once, and some may be very short lived. Therefore, it’s generally best if the extension focuses on handling the badges, contextual menus, and toolbar buttons. Place in a separate service (a Login Item or Launch Agent) any code that performs the sync, updates state, or communicates with remote data sources. This approach ensures that there is only one syncing service running at a time.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.