-
Notifications
You must be signed in to change notification settings - Fork 137
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
Convert CertStatusUpdate from VLV to paged search #4708
Convert CertStatusUpdate from VLV to paged search #4708
Conversation
Note: the VLV update was done on ordered elements. With the paged search elements are not ordered to avoid extra work since the order it is not relevant for the update.
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 have some comments for possible improvements, but they can be addressed separately later if you want. The changes look good. Feel free to update/merge.
Date notBefore = certRecord.getNotBefore(); | ||
if (notBefore.after(now)) { | ||
logger.debug("CertStatusUpdateTask: Cert " + certID.toHexString() + " not yet valid"); | ||
logger.debug("CertStatusUpdateTask: Cert {} not yet valid", certID.toHexString()); | ||
continue; | ||
} |
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 an existing code, but do you think we still need this check? IIUC getInvalidCertsByNotBeforeDate()
will return invalid certs that should have been valid at the provided time, so maybe it's not necessary to check again.
continue; | ||
} | ||
|
||
logger.debug("CertStatusUpdateTask: Cert " + certID.toHexString() + " has become valid"); | ||
logger.debug("CertStatusUpdateTask: Cert {} has become valid", certID.toHexString()); | ||
list.add(certID); |
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 also an existing code, but instead of storing all cert IDs into a list (which could be large) we probably can just update the cert immediately with this code:
repository.updateStatus(certID, CertRecord.STATUS_VALID);
if (!certRecIterator.hasNext()) { | ||
logger.debug("CertStatusUpdateTask: No invalid certs"); | ||
return; | ||
} |
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.
If we don't use a list of certIDs anymore, we won't need this check since the while
loop should be sufficient.
Date notAfter = certRecord.getNotAfter(); | ||
if (notAfter.after(now)) { | ||
logger.debug("CertStatusUpdateTask: Cert " + certID.toHexString() + " not yet expired"); | ||
logger.debug("CertStatusUpdateTask: Cert {} not yet expired", certID.toHexString()); | ||
continue; | ||
} |
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.
Same as above.
continue; | ||
} | ||
|
||
logger.debug("CertStatusUpdateTask: Cert " + certID.toHexString() + " has become expired"); | ||
logger.debug("CertStatusUpdateTask: Cert {} has become expired", certID.toHexString()); | ||
list.add(certID); |
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.
Same as above.
if (!certRecIterator.hasNext()) { | ||
logger.debug("CertStatusUpdateTask: No invalid certs"); | ||
return; | ||
} |
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.
Same as above.
Date notAfter = certRecord.getNotAfter(); | ||
if (notAfter.after(now)) { | ||
logger.debug("CertStatusUpdateTask: Cert " + certID.toHexString() + " not yet expired"); | ||
logger.debug("CertStatusUpdateTask: Cert {} not yet expired", certID.toHexString()); | ||
continue; | ||
} |
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.
Same as above.
continue; | ||
} | ||
|
||
logger.debug("CertStatusUpdateTask: Cert " + certID.toHexString() + " has become expired"); | ||
logger.debug("CertStatusUpdateTask: Cert {} has become expired", certID.toHexString()); | ||
list.add(certID); |
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.
Same as above, but we will need to update the issuing points too:
repository.updateStatus(certID, CertRecord.STATUS_REVOKED_EXPIRED);
for (CRLIssuingPoint issuingPoint : engine.getCRLIssuingPoints()) {
issuingPoint.addExpiredCert(certID.toBigInteger());
}
if (totalSize <= 0) { | ||
if (!certRecIterator.hasNext()) { | ||
logger.debug("CertStatusUpdateTask: No invalid certs"); | ||
return; | ||
} |
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.
Same as above.
Quality Gate passedIssues Measures |
Removing useless temporary lists needed to work with VLV
9d2dafc
to
2746200
Compare
@edewata Thanks! I have updated the |
@edewata IPA tests are becoming unstable. They fail in different places but if I try locally they works. Maybe we have a synchronization problem! Not sure when this issue was introduced but I started to observe few weeks ago |
Note: the VLV update was done on ordered elements. With the paged search elements are not ordered to avoid extra work since the order it is not relevant for the update.