*) fixed News deletion. News are now removed if they are no longer in a news-stack. This does not effect News-entires in the news-db that have no stack-entries.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3336 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
hydrox 18 years ago
parent a647a7ca8d
commit 9184113284

@ -92,14 +92,14 @@ public class News {
} }
yacyNewsRecord record; yacyNewsRecord record;
try { try {
if ((tableID == yacyNewsPool.PROCESSED_DB) || (tableID == yacyNewsPool.PUBLISHED_DB)) { // if ((tableID == yacyNewsPool.PROCESSED_DB) || (tableID == yacyNewsPool.PUBLISHED_DB)) {
yacyCore.newsPool.clear(tableID); // yacyCore.newsPool.clear(tableID);
} else { // } else {
while (yacyCore.newsPool.size(tableID) > 0) { while (yacyCore.newsPool.size(tableID) > 0) {
record = yacyCore.newsPool.get(tableID, 0); record = yacyCore.newsPool.get(tableID, 0);
yacyCore.newsPool.moveOff(tableID, record.id()); yacyCore.newsPool.moveOff(tableID, record.id());
} }
} // }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

@ -304,8 +304,19 @@ public class yacyNewsPool {
private boolean moveOff(yacyNewsQueue fromqueue, yacyNewsQueue toqueue, String id) throws IOException { private boolean moveOff(yacyNewsQueue fromqueue, yacyNewsQueue toqueue, String id) throws IOException {
// called if a published news shall be removed // called if a published news shall be removed
yacyNewsRecord record = fromqueue.remove(id); yacyNewsRecord record = fromqueue.remove(id);
if (record == null) return false; if (record == null) {
System.out.println("DEBUG: record == null");
return false;
}
if (toqueue != null) toqueue.push(record); if (toqueue != null) toqueue.push(record);
else if ((incomingNews.get(id) == null) && (processedNews.get(id) == null) && (outgoingNews.get(id) == null) && (publishedNews.get(id) == null)){
newsDB.remove(id);
System.out.println("DEBUG: News-ID " + id + " deleted");
}
if (incomingNews.get(id) != null) System.out.println("DEBUG: News-ID " + id + " in incomingNews");
if (processedNews.get(id) != null) System.out.println("DEBUG: News-ID " + id + " in processedNews");
if (outgoingNews.get(id) != null) System.out.println("DEBUG: News-ID " + id + " in outgoingNews");
if (publishedNews.get(id) != null) System.out.println("DEBUG: News-ID " + id + " in publishedNews");
return true; return true;
} }

Loading…
Cancel
Save