Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-18912

Scheduled journal article expiration is not reliable

    Details

    • Branch Version/s:
      6.0.x
    • Backported to Branch:
      Committed

      Description

      For some reason some Journal Articles that are scheduled to expire are sometimes not marked with state EXPIRED on our server. We digged into Liferay's scheduled article expiration logic and found following:

      Job com.liferay.portlet.journal.messaging.CheckArticleMessageListener is run by default every 15 minutes. This job calls com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.checkArticles() method that is responsible for setting EXPIRED state to articles that are scheduled to expire and whose expiration date has just passed. But the logic is not reliable.

      Current scheduled article expiration logic:
      1. Run the following operations every X minutes (configured, e.g. 15 minutes).
      2. Get all APPROVED articles that have expiration date between NOW and NOW minus X minutes.
      3. Set the status of all found articles as EXPIRED.

      What can go wrong with the current logic:
      A) If the server is down e.g. 1 hour and CheckArticleMessageListener is configured to be run every 15 minutes, then articles that were scheduled to expire during the first 45 minutes of downtime will not be marked as EXPIRED (state is still APPROVED).
      B) If something goes wrong when running the checkArticles() method, the articles that would have been set EXPIRED in this scheduled method run are not expired. Those articles are not checked anymore in the next scheduled method run because their expiration date does not fit into the X minutes gap.
      C) If the CheckArticleMessageListener is not run precisely every X minutes, e.g. if the next run is in X+1 minute, then there is again a 1 minute gap and if some articles were marked to expire during that 1 minute gap, they are not.

      Suggested article expiration logic:
      1. Run the following operations every X minutes (configured, e.g. 15 minutes).
      2. CHANGED: Get all APPROVED articles that have expiration date BEFORE NOW (e.g. 1.1.1970-NOW, or is there a reason why not do this?).
      3. Set the status of all found articles as EXPIRED.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pani.gui Pani Gui (Inactive)
                Reporter:
                adorjan.nagy Adorjan Nagy (Inactive)
                Participants of an Issue:
                Recent user:
                Esther Sanz
              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  8 years, 9 weeks, 2 days ago

                  Packages

                  Version Package
                  6.0.12 EE
                  6.1.0 CE RC1