-
Notifications
You must be signed in to change notification settings - Fork 9
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
#P39046999 Persist last (5) successful local deployments as part of CLI application code #164
base: main
Are you sure you want to change the base?
Conversation
Build is not successful, please address the errors. |
Build is not successful. You must fix your commit messages |
…plication code (#P39046999)
…plication code (#P39046999)
Client Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against f89da2a |
Server Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against f89da2a |
@@ -180,6 +185,27 @@ public void persistLocalDeployment(Topics serviceConfig, Map<String, Object> dep | |||
Topics localDeploymentDetails = localDeployments.lookupTopics(deploymentId); | |||
localDeploymentDetails.replaceAndWait(deploymentDetails); | |||
// TODO: [P41178971]: Implement a limit on no of local deployments to persist status for |
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.
remove the TODO, this has been resolved now.
} catch (InterruptedException e) { | ||
throw new RuntimeException(e); | ||
} |
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.
do not catch in tests, just let the test method throw InterruptedException
} | ||
cliEventStreamAgent.persistLocalDeployment(cliServiceConfig, localDeploymentDetails.convertToMapOfObject()); | ||
// to ensure topic add as order | ||
Thread.sleep(1000); |
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.
this is going to slow things down, just sleep 1ms and use context.waitForPublishQueueToClear()
after sleeping
…plication code (#P39046999)
messages fixed |
List<Topics> childrenToRemove = new ArrayList<>(); | ||
AtomicInteger deploymentSucceeded = new AtomicInteger(); | ||
localDeployments.forEach(topics -> { | ||
Topics deploymentTopics = (Topics) topics; |
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.
check using instanceof
before blindly casting to Topics
.
Topic existingChild = deploymentTopics.find(DEPLOYMENT_STATUS_KEY_NAME); | ||
String value = existingChild.getOnce().toString(); |
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.
use Coerce.toString(deploymentTopics.find(DEPLOYMENT_STATUS_KEY_NAME)
// if more than PERSIST_LIMIT deployments are success, remove until PERSIST_LIMIT left | ||
if (deploymentSucceeded.get() > PERSIST_LIMIT) { | ||
childrenToRemove.stream() | ||
.sorted(Comparator.comparingLong(t -> t.find(DEPLOYMENT_STATUS_KEY_NAME).getModtime())) |
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.
find may return null, you must handle this correctly.
Issue #, if available:
Description of changes:
Why is this change necessary:
How was this change tested:
Any additional information or context required to review the change:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.