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

Sync worker management: move logic out of companion object #1056

Merged
merged 4 commits into from
Oct 7, 2024

Conversation

rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Oct 5, 2024

Purpose

Currently, a lot of logic (managing one-time and periodic sync workers) happens in companion objects.

These objects are not ideal to use with DI and should rather contain constants and small helpers than real logic.

Short description

The logic of

  • building and enqueing one-time sync workers,
  • building and enabling/disabling periodic sync workers

is moved to a dedicated new class SyncWorkerBuilder which is usable with DI.

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.

@rfc2822 rfc2822 changed the title Sync worker management: move logic from companion object to new class Sync worker management: move logic out of companion object Oct 5, 2024
@rfc2822 rfc2822 added the refactoring Internal improvement of existing functions label Oct 5, 2024
@rfc2822 rfc2822 self-assigned this Oct 5, 2024
@rfc2822 rfc2822 requested a review from ArnyminerZ October 5, 2024 08:23
@rfc2822 rfc2822 marked this pull request as ready for review October 5, 2024 08:23
Copy link
Member

@ArnyminerZ ArnyminerZ left a comment

Choose a reason for hiding this comment

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

Works great, and now everything makes more sense IMO. It will also make more sense to add the PUSH notification in SyncWorkerManager instead of where it is now.

@rfc2822 rfc2822 merged commit fc7f42c into main-ose Oct 7, 2024
11 checks passed
@rfc2822 rfc2822 deleted the sync-worker-builder branch October 7, 2024 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Internal improvement of existing functions
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants