|
Issue Type:
|
Bug
|
Affects Versions:
|
3.2, 1.8.2, 1.7.2, 1.6.2, 1.5.2 |
Assignee:
|
Unassigned |
Attachments:
|
FeedServlet.java |
Components:
|
JSPUI |
Created:
|
20/Aug/13 11:55 AM
|
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)
|
Project:
|
DSpace
|
Labels:
|
feeds
|
Priority:
|
Major
|
Reporter:
|
Fabian Smagghe
|
Original Estimate:
|
30 minutes
|
Remaining Estimate:
|
30 minutes
|
|
|