Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-1635

RSS feeds not updating in JSPUI

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Volunteer Needed (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.5.2, 1.6.2, 1.7.2, 1.8.2, 3.2
    • Fix Version/s: None
    • Component/s: JSPUI
    • Labels:
    • Attachments:
      1
    • Comments:
      1
    • Documentation Status:
      Needed

      Description

      in JSPUI the org.dspace.app.webui.servlet.FeedServlet :

      *****
      // how many days to keep a feed in cache before checking currency
      private static int cacheAge = 0;
      ...
      cacheAge = ConfigurationManager.getIntProperty("webui.feed.cache.age");
      ...
      // Is the feed current?
      boolean cacheFeedCurrent = false;
      if (cFeed.timeStamp + (cacheAge * HOUR_MSECS) < System.currentTimeMillis())
      {
      cacheFeedCurrent = true;
      }
      // Not current, but have any items changed since feed was created/last checked?
      else if ( ! itemsChanged(context, dso, cFeed.timeStamp))
      {
      // no items have changed, re-stamp feed and use it
      cFeed.timeStamp = System.currentTimeMillis();
      cacheFeedCurrent = true;
      }
      ...
      *****

      in my dspace.cfg webui.feed.cache.age = 2
      => cacheAge = 2 hours

      1) When I started the server at 2013-08-20T08:00:00Z am and I checked the rss feed at 2013-08-20T08:01:00Z, cFeed.timeStamp = 2013-08-20T08:01:00Z
      If nobody click on the RSS link before 11am,
      the line
      "if (cFeed.timeStamp + (cacheAge * HOUR_MSECS) < System.currentTimeMillis())"
      is equivalent to
      "if (2013-08-20T08:01:00Z + 2 hours < 2013-08-20T11:00:00Z)"
      which is always true and the FeedServlet sends the feed that was cached at 2013-08-20T08:01:00Z

      I think the code should be :

      ****
      if (cFeed.timeStamp + (cacheAge * HOUR_MSECS) > System.currentTimeMillis())

      {...}

      ****

      2) If we assume that the first "if" (see above) gives false, the servlet calls the function itemsChanged()
      in function itemsChanged, we call
      Harvest.harvest(context, dso, startDate, endDate,
      0, 1, !includeAll, false, false, includeAll).size() > 0)
      where startDate and endDate are truncated date ( "startDate = dcStartDate.toString().substring(0, 10)")
      in this case, in my example, we call
      Harvest.harvest(context, dso, 2013-08-20T00:00:00Z, 2013-08-20T00:00:00Z,
      0, 1, !includeAll, false, false, includeAll).size() > 0)
      If new items are archived in the repository (e.g: archived at 2013-08-20T10:30:00Z) we don't see this items in the rss feed because "itemsChanged(context, dso, cFeed.timeStamp)" return false and the FeedServlet sends the feed that was cached at 2013-08-20T08:01:00Z

      I think the code of the function "itemsChanged" should be :

      ****
      private boolean itemsChanged(Context context, DSpaceObject dso, long timeStamp)
      throws SQLException
      {
      // construct start and end dates
      DCDate dcStartDate = new DCDate( new Date(timeStamp) );
      DCDate dcEndDate = new DCDate( new Date(System.currentTimeMillis()) );

      // // convert dates to ISO 8601, stripping the time
      // String startDate = dcStartDate.toString().substring(0, 10);
      // String endDate = dcEndDate.toString().substring(0, 10);

      // this invocation should return a non-empty list if even 1 item has changed
      try

      { return (Harvest.harvest(context, dso, dcStartDate.toString(), dcEndDate.toString(), 0, 1, !includeAll, false, false, includeAll).size() > 0); }

      catch (ParseException pe)

      { // This should never get thrown as we have generated the dates ourselves return false; }

      }

      in attachement the FeedServlet.java updated (DSpace 3.2)

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            fsmagghe Fabian Smagghe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

                Estimated:
                Original Estimate - 30 minutes
                30m
                Remaining:
                Remaining Estimate - 30 minutes
                30m
                Logged:
                Time Spent - Not Specified
                Not Specified