You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cs...@apache.org on 2024/04/16 13:09:54 UTC

(sling-org-apache-sling-distribution-journal) branch SLING-12289 updated: SLING-12289 - Only set store status if it does not yet exist

This is an automated email from the ASF dual-hosted git repository.

cschneider pushed a commit to branch SLING-12289
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal.git


The following commit(s) were added to refs/heads/SLING-12289 by this push:
     new 8af4c44  SLING-12289 - Only set store status if it does not yet exist
8af4c44 is described below

commit 8af4c449ba1669cea01b0979d23146b743fc5e84
Author: Christian Schneider <cs...@adobe.com>
AuthorDate: Tue Apr 16 15:09:47 2024 +0200

    SLING-12289 - Only set store status if it does not yet exist
---
 .../distribution/journal/impl/precondition/PackageStatusWatcher.java   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/distribution/journal/impl/precondition/PackageStatusWatcher.java b/src/main/java/org/apache/sling/distribution/journal/impl/precondition/PackageStatusWatcher.java
index 89eee8f..936cb84 100644
--- a/src/main/java/org/apache/sling/distribution/journal/impl/precondition/PackageStatusWatcher.java
+++ b/src/main/java/org/apache/sling/distribution/journal/impl/precondition/PackageStatusWatcher.java
@@ -91,8 +91,7 @@ public class PackageStatusWatcher implements Closeable {
 
     private void handle(MessageInfo info, PackageStatusMessage pkgStatusMsg) {
         long pkgOffset = pkgStatusMsg.getOffset();
-        // TODO: check revision
         Map<Long, Status> agentStatus = getAgentStatus(pkgStatusMsg.getSubAgentName());
-        agentStatus.put(pkgOffset, pkgStatusMsg.getStatus());
+        agentStatus.computeIfAbsent(pkgOffset, offset -> pkgStatusMsg.getStatus());
     }
 }