- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 2
 
feat: configurable sync schedule #188
Conversation
          
Reviewer's Guide by SourceryThis pull request introduces a configurable sync schedule for the registry synchronization process. It includes a new settings page, a flexible configuration system, and refactored sync service logic to dynamically check the sync interval. It also includes database migrations to support the new configuration options. Sequence Diagram for Scheduled Sync ChecksequenceDiagram
  participant RegistrySyncService
  participant Database
  RegistrySyncService->>Database: getConfigValue('sync_interval')
  activate Database
  Database-->>RegistrySyncService: syncIntervalSetting
  deactivate Database
  RegistrySyncService->>RegistrySyncService: currentTime - lastSyncTime > syncIntervalMs
  alt needsSync == true
    RegistrySyncService->>RegistrySyncService: performSync()
    activate RegistrySyncService
    RegistrySyncService->>RegistrySyncService: getRegistryReposAxios()
    RegistrySyncService->>Database: incrementalSync()
    activate Database
    Database-->>RegistrySyncService: Success/Failure
    deactivate Database
    RegistrySyncService->>Database: Update sync statistics
    activate Database
    Database-->>RegistrySyncService: Success/Failure
    deactivate Database
    RegistrySyncService-->>RegistrySyncService: Complete
    deactivate RegistrySyncService
  else needsSync == false
    RegistrySyncService->>RegistrySyncService: Skip sync
  end
    Entity Relationship Diagram for App Config TableerDiagram
    app_config {
        string key PK
        string value
        integer updated_at
    }
    Updated Class Diagram for RegistrySyncServiceclassDiagram
  class RegistrySyncService {
    - static instance: RegistrySyncService
    - logger: Logger
    - cronJob: cron.ScheduledTask
    - isSyncing: boolean
    - constructor()
    - scheduledSyncCheck(): Promise<void>
    - performSync(): Promise<void>
    + static getInstance(): RegistrySyncService
    + start(): void
    + stop(): void
    + syncNow(forceFullSync: boolean): void
  }
  note for RegistrySyncService "Sync interval is now configurable via database settings."
    File-Level Changes
 Tips and commandsInteracting with Sourcery
 Customizing Your ExperienceAccess your dashboard to: 
 Getting Help
  | 
    
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.
Copilot reviewed 19 out of 35 changed files in this pull request and generated no comments.
Files not reviewed (16)
- package.json: Language not supported
 - src/lib/components/header/header.svelte: Language not supported
 - src/lib/components/ui/button/button.svelte: Language not supported
 - src/lib/components/ui/form/form-button.svelte: Language not supported
 - src/lib/components/ui/form/form-description.svelte: Language not supported
 - src/lib/components/ui/form/form-element-field.svelte: Language not supported
 - src/lib/components/ui/form/form-field-errors.svelte: Language not supported
 - src/lib/components/ui/form/form-field.svelte: Language not supported
 - src/lib/components/ui/form/form-fieldset.svelte: Language not supported
 - src/lib/components/ui/form/form-label.svelte: Language not supported
 - src/lib/components/ui/form/form-legend.svelte: Language not supported
 - src/lib/components/ui/label/label.svelte: Language not supported
 - src/lib/components/ui/select/select-content.svelte: Language not supported
 - src/lib/components/ui/select/select-group-heading.svelte: Language not supported
 - src/lib/components/ui/select/select-item.svelte: Language not supported
 - src/lib/components/ui/select/select-scroll-down-button.svelte: Language not supported
 
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.
Hey @kmendell - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider using a shared type definition for the configuration settings to ensure consistency between client and server.
 - The sync interval is checked every minute; consider making this configurable as well.
 
Here's what I looked at during the review
- 🟢 General issues: all looks good
 - 🟢 Security: all looks good
 - 🟢 Testing: all looks good
 - 🟡 Complexity: 1 issue found
 - 🟢 Documentation: all looks good
 
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| 
           @sourcery-ai review  | 
    
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.
Hey @kmendell - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider using a constant for the cron schedule string to avoid duplication and improve maintainability.
 - The migrations file includes a migration to update the settings table to accept string values, but the code still uses INTEGER in some places; ensure consistency.
 
Here's what I looked at during the review
- 🟢 General issues: all looks good
 - 🟢 Security: all looks good
 - 🟢 Testing: all looks good
 - 🟡 Complexity: 1 issue found
 - 🟢 Documentation: all looks good
 
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Implement configurable sync schedule for registry synchronization with a new settings page and dynamic sync interval configuration
New Features:
Enhancements:
Deployment:
Documentation: