Skip to content

feat: Allow task processor to have its own database #5406

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

emyller
Copy link
Contributor

@emyller emyller commented Apr 30, 2025

Fixes #5136.


Thanks for submitting a PR! Please check the boxes below:

  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Based on the original issue (#5136) description.

  • Introduce a new router.
  • Introduce database settings.
  • Handle migrations.

How did you test this code?

  • Unit tests.
  • Manual testing (new deployments).
  • Manual testing (existing deployments).

@emyller emyller self-assigned this Apr 30, 2025
Copy link

vercel bot commented Apr 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2025 11:06pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
flagsmith-frontend-preview ⬜️ Ignored (Inspect) Visit Preview May 8, 2025 11:06pm
flagsmith-frontend-staging ⬜️ Ignored (Inspect) Visit Preview May 8, 2025 11:06pm

@github-actions github-actions bot added api Issue related to the REST API feature New feature or request labels Apr 30, 2025
Copy link
Contributor

github-actions bot commented Apr 30, 2025

Uffizzi Ephemeral Environment Deploying

☁️ https://app.uffizzi.com/github.com/Flagsmith/flagsmith/pull/5406

⚙️ Updating now by workflow run 14917815120.

What is Uffizzi? Learn more!

@emyller emyller force-pushed the feat/separate-task-processor-database branch from 9e7caa8 to f29b8bd Compare April 30, 2025 18:11
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Apr 30, 2025
Copy link

codecov bot commented Apr 30, 2025

Codecov Report

Attention: Patch coverage is 71.66667% with 17 lines in your changes missing coverage. Please review.

Project coverage is 97.59%. Comparing base (4aa9e1b) to head (516bbec).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
api/app/routers.py 45.16% 17 Missing ⚠️

❌ Your patch check has failed because the patch coverage (71.66%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5406      +/-   ##
==========================================
- Coverage   97.63%   97.59%   -0.04%     
==========================================
  Files        1234     1234              
  Lines       42992    43052      +60     
==========================================
+ Hits        41974    42017      +43     
- Misses       1018     1035      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels May 1, 2025
Copy link
Contributor

@matthewelwell matthewelwell left a comment

Choose a reason for hiding this comment

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

Looks good to me, but there are a couple of general comments:

  1. I'd love to see in the description confirmation that this has been tested manually
  2. We should add these new settings to the docs

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels May 1, 2025
Comment on lines +163 to +170


class TaskProcessorRouter:
"""
Routing of database operations for task processor models

This router is used if TASK_PROCESSOR_DATABASE_* settings are defined.
"""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Flagsmith/flagsmith-back-end It makes sense for this router to live here, because the behavior is demanded by the API specifically. However, because it looks very standard for now, it feels like it could be offered by flagsmith-common. What's the team opinion on this? I'm happy to go either path, though I believe testing and docs would be easier if contained in flagsmith[-core].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, moved to flagsmith-common (Flagsmith/flagsmith-common@ec6c2e5), as it was actually necessary. I will update this PR next time I'm working on this, likely on Monday, and resolve this thread afterwards.

@github-actions github-actions bot added the docs Documentation updates label May 1, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request docs Documentation updates labels May 1, 2025
@github-actions github-actions bot added the docs Documentation updates label May 8, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request docs Documentation updates labels May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow for using a dedicated database for task processor tables
2 participants