Skip to content
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

Debug info: print all workers #1200

Open
wants to merge 2 commits into
base: main-ose
Choose a base branch
from

Conversation

ArnyminerZ
Copy link
Member

@ArnyminerZ ArnyminerZ commented Dec 27, 2024

Purpose

Right now we only provide the information of the individual sync workers for each account and data type, but no information about the "generic" workers is provided.

Example:

Sync workers:

┌───────────────────────────────────────┬─────────────────┬─────────────┬─────────┬────────────┬────────────────┐
│ Tags                                  │ State           │ Next run    │ Retries │ Generation │ Periodicity    │
├───────────────────────────────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────┤
│ [.sync.account.AccountsCleanupWorker] │ ENQUEUED (-256) │ In 20 hours │ 0       │ 11         │ every 1440 min │
└───────────────────────────────────────┴─────────────────┴─────────────┴─────────┴────────────┴────────────────┘

Short description

  • Added workersInfoTable in DebugInfoModel which allows generating tables for workers in a more generic way.
  • Added information for AccountsCleanupWorker.

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

@ArnyminerZ ArnyminerZ linked an issue Dec 27, 2024 that may be closed by this pull request
@ArnyminerZ
Copy link
Member Author

ArnyminerZ commented Dec 27, 2024

@rfc2822 I've added the info for AccountsCleanupWorker, I don't know if any other one is desirable.

@ArnyminerZ ArnyminerZ self-assigned this Dec 27, 2024
@ArnyminerZ ArnyminerZ requested a review from rfc2822 December 27, 2024 11:46
@ArnyminerZ ArnyminerZ added the enhancement New feature or request label Dec 27, 2024
@ArnyminerZ ArnyminerZ marked this pull request as ready for review December 27, 2024 11:46
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have a list of all "other" workers which are not mentioned in the account section? Reason is that there may be old workers which have not been cancelled correctly, for instance by migrations.

Maybe we can return the IDs of the workers when we dump the account workers, remember them and at the end print all other workers (= those which were not printed yet). Or something similar.

Also I think it's time to move the debug info generation into a separate class DebugInfoGenerator, then it won't clutter the model (still UI layer) so much.

@rfc2822 rfc2822 force-pushed the 1197-debug-info-print-all-workers branch from cd4315c to 39680ee Compare January 10, 2025 15:39
@rfc2822 rfc2822 requested a review from sunkup January 13, 2025 12:37
Copy link
Member

@sunkup sunkup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AccountsCleanupWorker is not a "sync" worker. I would rename one or both of the dumpSyncWorkersInfo methods to dumpWorkersInfo.

Not sure we really need to be able to generate other tables besides "Sync workers" and the new "Generic workers" table. Having a generic generation function seems a bit overengineered to me, but I guess it might come in handy.

@@ -395,6 +397,11 @@ class DebugInfoModel @AssistedInject constructor(
dumpAddressBookAccount(account, accountManager, writer)
}

// general-purpose sync workers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are general-purpose sync workers? We have either sync workers or "non-sync" (general purpose) workers.

@@ -395,6 +397,11 @@ class DebugInfoModel @AssistedInject constructor(
dumpAddressBookAccount(account, accountManager, writer)
}

// general-purpose sync workers
writer.append("\nSync workers:\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably say "Generic workers" here?

private fun dumpSyncWorkersInfo(): String =
workersInfoTable(
WorkQuery.Builder.fromUniqueWorkNames(
listOf(AccountsCleanupWorker.NAME)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could add PushRegistrationWorker and RefreshCollectionsWorker here too no? Why even have the list in the first place? Would it not be possible to query all existing work and simply subtract the sync workers? Or is that very complicated to do?

@rfc2822 rfc2822 force-pushed the 1197-debug-info-print-all-workers branch from 39680ee to e0c1a8b Compare January 18, 2025 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debug info: print all workers
3 participants