Skip to content

Query dynamic cache key computation #12814

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

Merged
merged 6 commits into from
Jun 24, 2025
Merged

Query dynamic cache key computation #12814

merged 6 commits into from
Jun 24, 2025

Conversation

charlesBochet
Copy link
Member

@charlesBochet charlesBochet commented Jun 24, 2025

In this PR:

  • add query hashKey to ObjectMetadataItems query graphql cache to avoid caching outdated queries
  • improve performance by removing ResolveField at FieldLevel and adding this at resolver level

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Major performance optimizations for metadata handling and localization, particularly around field metadata resolution and caching.

  • Improved caching in engine/api/graphql/graphql-config/hooks/use-cached-metadata.ts by implementing SHA-256 query hashing to prevent cache collisions
  • Optimized field-metadata.service.ts by converting async operations to sync and simplifying locale handling
  • Enhanced DataloaderService in dataloader.service.ts to batch field metadata localization, preventing N+1 queries
  • Streamlined object-metadata.resolver.ts to handle locale information at the resolver level for better query optimization

5 files reviewed, 3 comments
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

github-actions bot commented Jun 24, 2025

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:2799

This environment will automatically shut down when the PR is closed or after 5 hours.

@prastoin prastoin changed the title Improve performances Query dynamic cache key computation Jun 24, 2025
async resolveOverridableString(
fieldMetadata: FieldMetadataDTO,
resolveOverridableString(
fieldMetadata: Pick<
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Record args

@prastoin prastoin self-requested a review June 24, 2025 11:40
Copy link
Contributor

@prastoin prastoin left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@prastoin prastoin left a comment

Choose a reason for hiding this comment

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

I could fall in love for less

@prastoin
Copy link
Contributor

Copy link
Contributor

github-actions bot commented Jun 24, 2025

📊 API Changes Report

REST API Changes

Summary

🔄 Changed Operations (63)

  • /apiKeys/duplicates: Modified operation
  • /attachments/duplicates: Modified operation
  • /blocklists/duplicates: Modified operation
  • /calendarChannelEventAssociations/duplicates: Modified operation
  • /calendarChannels/duplicates: Modified operation
  • /calendarEventParticipants/duplicates: Modified operation
  • /calendarEvents/duplicates: Modified operation
  • /companies/duplicates: Modified operation
  • /connectedAccounts/duplicates: Modified operation
  • /favoriteFolders/duplicates: Modified operation
  • /favorites/duplicates: Modified operation
  • /messageChannelMessageAssociations/duplicates: Modified operation
  • /messageChannels/duplicates: Modified operation
  • /messageFolders/duplicates: Modified operation
  • /messageParticipants/duplicates: Modified operation
  • /messages/duplicates: Modified operation
  • /messageThreads/duplicates: Modified operation
  • /notes/duplicates: Modified operation
  • /noteTargets/duplicates: Modified operation
  • /opportunities/duplicates: Modified operation
  • /people/duplicates: Modified operation
  • /pets/duplicates: Modified operation
  • /rockets/duplicates: Modified operation
  • /surveyResults/duplicates: Modified operation
  • /tasks/duplicates: Modified operation
  • /taskTargets/duplicates: Modified operation
  • /timelineActivities/duplicates: Modified operation
  • /viewFields/duplicates: Modified operation
  • /viewFilterGroups/duplicates: Modified operation
  • /viewFilters/duplicates: Modified operation
  • /viewGroups/duplicates: Modified operation
  • /views/duplicates: Modified operation
  • /viewSorts/duplicates: Modified operation
  • /webhooks/duplicates: Modified operation
  • /workflowAutomatedTriggers/duplicates: Modified operation
  • /workflowRuns/duplicates: Modified operation
  • /workflows/duplicates: Modified operation
  • /workflowVersions/duplicates: Modified operation
  • /workspaceMembers/duplicates: Modified operation
  • /apiKeys: Modified operation
  • /apiKeys/{id}: Modified operation
  • /calendarEvents: Modified operation
  • /calendarEvents/{id}: Modified operation
  • /companies: Modified operation
  • /companies/{id}: Modified operation
  • /opportunities: Modified operation
  • /opportunities/{id}: Modified operation
  • /people: Modified operation
  • /people/{id}: Modified operation
  • /pets: Modified operation
  • /pets/{id}: Modified operation
  • /viewFields: Modified operation
  • /viewFields/{id}: Modified operation
  • /viewFilters: Modified operation
  • /viewFilters/{id}: Modified operation
  • /viewGroups: Modified operation
  • /viewGroups/{id}: Modified operation
  • /views: Modified operation
  • /views/{id}: Modified operation
  • /viewSorts: Modified operation
  • /viewSorts/{id}: Modified operation
  • /workspaceMembers: Modified operation
  • /workspaceMembers/{id}: Modified operation

⚠️ Please review these API changes carefully before merging.

⚠️ Breaking Change Protocol

Breaking changes detected but PR title does not contain "breaking" - CI will pass but action needed.

🔄 Options:

  1. If this IS a breaking change: Add "breaking" to your PR title and add BREAKING CHANGE: to your commit message
  2. If this is NOT a breaking change: The API diff tool may have false positives - please review carefully

For breaking changes, add to commit message:

feat: add new API endpoint

BREAKING CHANGE: removed deprecated field from User schema

@prastoin prastoin enabled auto-merge (squash) June 24, 2025 12:01
@prastoin prastoin merged commit 4ac208c into main Jun 24, 2025
59 checks passed
@prastoin prastoin deleted the improve-performances branch June 24, 2025 12:04
abdulrahmancodes pushed a commit to abdulrahmancodes/twenty that referenced this pull request Jun 26, 2025
In this PR:
- add query hashKey to ObjectMetadataItems query graphql cache to avoid
caching outdated queries
- improve performance by removing ResolveField at FieldLevel and adding
this at resolver level
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants