From 91841132848ef2083a6b50931b790d67abc28928 Mon Sep 17 00:00:00 2001 From: hydrox Date: Mon, 5 Feb 2007 13:35:36 +0000 Subject: [PATCH] *) 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 --- htroot/News.java | 8 ++++---- source/de/anomic/yacy/yacyNewsPool.java | 13 ++++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/htroot/News.java b/htroot/News.java index 96dafaf79..ba522e749 100644 --- a/htroot/News.java +++ b/htroot/News.java @@ -92,14 +92,14 @@ public class News { } yacyNewsRecord record; try { - if ((tableID == yacyNewsPool.PROCESSED_DB) || (tableID == yacyNewsPool.PUBLISHED_DB)) { - yacyCore.newsPool.clear(tableID); - } else { +// if ((tableID == yacyNewsPool.PROCESSED_DB) || (tableID == yacyNewsPool.PUBLISHED_DB)) { +// yacyCore.newsPool.clear(tableID); +// } else { while (yacyCore.newsPool.size(tableID) > 0) { record = yacyCore.newsPool.get(tableID, 0); yacyCore.newsPool.moveOff(tableID, record.id()); } - } +// } } catch (IOException e) { e.printStackTrace(); } diff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.java index c8e88376f..22cf08f62 100644 --- a/source/de/anomic/yacy/yacyNewsPool.java +++ b/source/de/anomic/yacy/yacyNewsPool.java @@ -304,8 +304,19 @@ public class yacyNewsPool { private boolean moveOff(yacyNewsQueue fromqueue, yacyNewsQueue toqueue, String id) throws IOException { // called if a published news shall be removed 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); + 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; }