-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: include application name in subscription el #10651
base: master
Are you sure you want to change the base?
Conversation
3c40670
to
39b3784
Compare
...ry/mongodb/management/upgrade/upgrader/subscription/SubscriptionApplicationNameUpgrader.java
Outdated
Show resolved
Hide resolved
String applicationId = subscriptionDoc.get("application").toString(); | ||
return new SubscriptionApplicationPair( | ||
subscriptionDoc, | ||
getCollection("applications").find(Filters.eq("_id", applicationId)).first() |
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.
Another way to go about it could be:
- get a set of all the application ids from the subscriptions that you found
- search applications to recuperate all the applications with those ids
- create a HashMap in your class with the key as the application Id and the value as the application name or application
- for each subscription in your list, create an update model with the subscription id + application name, found via the HashMap with the subscription's application id
I'm not sure if this would be more "efficient", but it would be less network calls instead of calling the DB for every subscription that you find. WDYT?
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.
Being inspired by your suggestion, I decided to execute 1 bulkAction per 1 application, so that we have flat number of updates. What do you think now?
@jhaeyaert can you think about any further optimization/is this approach good enough for prod?
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 think the way it is done is ok. I would add a split into bulks of, let's say 1000, instead of having 1 single bulk to avoid loading all in memory. We already saw > 90k applications in some hard cases.
8da4cf3
to
73c7496
Compare
… limit bulkActions
ec18973
to
c30694a
Compare
Issue
https://gravitee.atlassian.net/browse/APIM-5979
Description
include application name in subscription el
Additional context
gravitee-io/gravitee-gateway-api#268
📚 View the storybook of this branch here