-
Notifications
You must be signed in to change notification settings - Fork 10
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
[PLA-2023] Improve metadata caching #260
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
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.
I've not tested it yet but I wonder if wouldn't be better to dispatch the requests as jobs instead of using a worker.
And maybe use a "lower priority" queue
I'm considering using concurrency in laravel instead of queue so I can still show the actual progress in the progress bar. |
|
My concern is making the requets too fast, concurrency could make it even worse. I'm thinking about this scenario:
Making too many requests at once could get us flagged as being a "bot/spammer" and rate-limit us or even get us blocked. I don't think there is a "urgency" to complete this "job" as fast as possible. Making something more slow but steady could be a better approach, also not sure that we do need to follow the progress. Maybe could we store something like: "metadata_last_updated_at" ? Just throwing some ideas here, let me know what you think |
That's a good point, however aside from performance I wanna make sure that the user will always get the updated metadata, that's why its important to finish it fast. I've also considered Maybe we can consider a webhook were adaptors need to call to make sure that platform will know that the metadata is updated, otherwise we'll sync them in a scheduled manner. For this case, I'm okay synching it in a slow manner. |
Wouldn't a mutation |
Yea, creating a mutation is fine as well. As long as adaptor has the ability to refresh it themselves. But we need to mention this in the docs |
PR Type
enhancement, configuration changes
Description
SyncAttributeMetadata
to sync attribute metadata to cache, improving performance.MetadataService
with methodsfetchAndCache
andgetCache
for efficient metadata retrieval.Token
model to utilize cached metadata instead of fetching it directly.data_chunk_size
setting.CoreServiceProvider
.Changes walkthrough 📝
enjin-platform.php
Add configuration for attribute metadata syncing
config/enjin-platform.php
sync_metadata
array withdata_chunk_size
setting.SyncAttributeMetadata.php
Implement SyncAttributeMetadata command for caching
src/Commands/SyncAttributeMetadata.php
SyncAttributeMetadata
.CoreServiceProvider.php
Register SyncAttributeMetadata command in service provider
src/CoreServiceProvider.php
SyncAttributeMetadata
command.Token.php
Use cached metadata in Token model
src/Models/Laravel/Token.php
MetadataService::fetch
withMetadataService::getCache
.MetadataService.php
Enhance MetadataService with caching capabilities
src/Services/Database/MetadataService.php
fetchAndCache
andgetCache
methods.