Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-28415

Avoid unnecessary save document in ProxySubscriptionPropagationListener

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.10
    • Fix Version/s: HOTFIX_10.10
    • Component/s: Publishing
    • Tags:
    • Backlog priority:
      300

      Description

      The class ProxySubscriptionPropagationListener contains this piece of code

              List<String> replacedProxyIds = (List<String>) ctx.getProperties().get(CoreEventConstants.REPLACED_PROXY_IDS);
              if (replacedProxyIds == null) {
                  return;
              }        for (String replacedProxyId : replacedProxyIds) {
                  // there should be only one replaced proxy, but just in case,
                  // iterate over them
                  DocumentModel fromDoc = ctx.getCoreSession().getDocument(new IdRef(replacedProxyId));
                  fromDoc.getAdapter(SubscriptionAdapter.class).copySubscriptionsTo(publishedDoc);
              }
              ctx.getCoreSession().saveDocument(publishedDoc); 
      

      where saveDocument is called even if the list replacedProxyIds is empty. Only the case when this list is null will avoid the save.

      It would be nice to extend the conditions when saveDocument is not called.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tmartins Thierry Martins
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: