tmaret commented on a change in pull request #101:
URL:
https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/101#discussion_r830177074
##########
File path: pom.xml
##########
@@ -103,7 +103,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.distribution.api</artifactId>
- <version>0.6.0</version>
+ <version>0.6.1-T20220311132800-6d5b189</version>
Review comment:
Please reference a SNAPSHOT here
##########
File path:
src/main/java/org/apache/sling/distribution/journal/bookkeeper/BookKeeper.java
##########
@@ -153,7 +158,7 @@ public void importPackage(PackageMessage pkgMsg, long
offset, long createdTime)
ResourceResolver importerResolver =
getServiceResolver(SUBSERVICE_IMPORTER)) {
packageHandler.apply(importerResolver, pkgMsg);
if (config.isEditable()) {
- storeStatus(importerResolver, new
PackageStatus(PackageStatusMessage.Status.IMPORTED, offset,
pkgMsg.getPubAgentName()));
+ storeStatus(importerResolver, new
PackageStatus(Status.APPLIED, offset, pkgMsg.getPubAgentName()));
Review comment:
Should be changed back to `IMPORTED`
##########
File path:
src/main/java/org/apache/sling/distribution/journal/bookkeeper/BookKeeper.java
##########
@@ -165,14 +170,48 @@ public void importPackage(PackageMessage pkgMsg, long
offset, long createdTime)
packageRetries.clear(pkgMsg.getPubAgentName());
- Event event = new ImportedEvent(pkgMsg,
config.getSubAgentName()).toEvent();
+ Event event = new AppliedEvent(pkgMsg,
config.getSubAgentName()).toEvent();
eventAdmin.postEvent(event);
log.info("Imported distribution package {} at offset={}", pkgMsg,
offset);
} catch (DistributionException | LoginException | IOException |
RuntimeException | ImportPostProcessException e) {
failure(pkgMsg, offset, e);
}
}
-
+
+ public void invalidateCache(PackageMessage pkgMsg, long offset) throws
DistributionException {
+ log.debug("Invalidating the cache for the package {} at offset={}",
pkgMsg, offset);
+ try (ResourceResolver resolver =
getServiceResolver(SUBSERVICE_BOOKKEEPER)) {
+ Map<String, Object> props = new HashMap<>();
+ props.put(DISTRIBUTION_TYPE, pkgMsg.getReqType().name());
+ props.put(DISTRIBUTION_PATHS, pkgMsg.getPaths());
+ props.put(DISTRIBUTION_PACKAGE_ID, pkgMsg.getPkgId());
+
+ long invalidationStartTime = currentTimeMillis();
+
distributionMetricsService.getInvalidationProcessRequest().increment();
+
+ invalidationProcessor.process(props);
+
+ if (config.isEditable()) {
+ storeStatus(resolver, new PackageStatus(Status.APPLIED,
offset, pkgMsg.getPubAgentName()));
Review comment:
Should be changed to `IMPORTED`
##########
File path: pom.xml
##########
@@ -145,7 +145,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.distribution.journal.messages</artifactId>
- <version>0.3.0</version>
+ <version>0.4.1-SNAPSHOT-T20220311145100-3a1628b</version>
Review comment:
Same here
##########
File path:
src/main/java/org/apache/sling/distribution/journal/bookkeeper/BookKeeper.java
##########
@@ -208,7 +247,7 @@ private void failure(PackageMessage pkgMsg, long offset,
Exception e) throws Dis
boolean giveUp = errorQueueEnabled && retries >=
config.getMaxRetries();
String retriesSt = errorQueueEnabled ?
Integer.toString(config.getMaxRetries()) : "infinite";
String action = giveUp ? "skip the package" : "retry later";
- String msg = format("Failed attempt (%s/%s) to import the distribution
package %s at offset=%d because of '%s', the importer will %s", retries,
retriesSt, pkgMsg, offset, e.getMessage(), action);
Review comment:
Please keep `import` to keep the statement matched by existing log
parsing tools
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]