-
Notifications
You must be signed in to change notification settings - Fork 9
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
sync-single-account.py #968
Conversation
sync_engine_class: ClassVar[type["FolderSyncEngine"]] | ||
|
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.
I've moved this out of an initializer so the thread class used to sync a single folder can be accessed without constructing a monitor. A monitor is a parent thread used to sync all the folders.
@@ -55,174 +55,6 @@ | |||
MAX_DOWNLOAD_COUNT = 1 | |||
|
|||
|
|||
class GmailSyncMonitor(ImapSyncMonitor): |
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.
I just switched the order of classes here so I can access GmailFolderSyncEngine
from GmailSyncMonitor
@cache | ||
def get_monitor_classes() -> dict[str, Type[BaseMailSyncMonitor]]: | ||
""" | ||
Return a dictionary mapping provider names to their respective monitor | ||
""" | ||
monitor_classes = { | ||
module.PROVIDER: getattr(module, module.SYNC_MONITOR_CLS) | ||
for module in module_registry.values() | ||
if hasattr(module, "SYNC_MONITOR_CLS") | ||
} | ||
|
||
for provider_name, _ in providers.items(): | ||
if provider_name not in monitor_classes: | ||
monitor_classes[provider_name] = monitor_classes["generic"] | ||
|
||
return monitor_classes |
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.
This was extracted from SyncService
intializer so I can use this from the script. This code is itself terribly dynamic but sync-engine was built to be extended by installing external modules like plugins, something that we don't do ourselves but I don't want to change it right now.
class GmailSyncMonitor(ImapSyncMonitor): | ||
sync_engine_class: ClassVar[type[FolderSyncEngine]] = GmailFolderSyncEngine |
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.
And this code was moved below with
sync_engine_class: ClassVar[type[FolderSyncEngine]] = GmailFolderSyncEngine
moved from the initializer to class body.
9cec5bf
to
43adde2
Compare
This is something that I did over and over using sync-engine console to debug escalations and otherwise troubleshoot syncing of a single account. Since it is not obvious how to do it I wrapped it in a script so everybody can use it.