Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
correct NewPool rentention calculation (was still clearing everything after one day)
reger4386e84b55f9
diff --git a/source/net/yacy/peers/NewsPool.java b/source/net/yacy/peers/NewsPool.javaindex 1c40ee086..1f13232f8 100644--- a/source/net/yacy/peers/NewsPool.java+++ b/source/net/yacy/peers/NewsPool.java@@ -423,41 +423,47 @@ public class NewsPool {* @return true if news should be removed*/private static boolean automaticProcessP(final SeedDB seedDB, final NewsDB.Record record) {- if (record == null) return false;- if (record.category() == null) return true;-- final long created = record.created().getTime();- final long duration = System.currentTimeMillis() - created;-- if ((record.category().equals(CATEGORY_WIKI_UPDATE)) &&- (duration > (3L * MILLISECONDS_PER_DAY))) {- return true;- }- if ((record.category().equals(CATEGORY_BLOG_ADD)) &&- (duration > (3L * MILLISECONDS_PER_DAY))) {- return true;- }- if ((record.category().equals(CATEGORY_PROFILE_UPDATE)) &&- (duration > (3L * MILLISECONDS_PER_DAY))) {- return true;- }- if ((record.category().equals(CATEGORY_CRAWL_START)) &&- (duration > (3L * MILLISECONDS_PER_DAY))) {- final Seed seed = seedDB.get(record.originator());- if (seed == null) return true;- try {- return (Integer.parseInt(seed.get(Seed.ISPEED, "-")) < 10);- } catch (final NumberFormatException ee) {- return true;- }+ if (record == null) {+ return false;}- if ((record.category().equals(CATEGORY_TRANSLATION_ADD) || record.category().equals(CATEGORY_TRANSLATION_VOTE_ADD))- && (duration > (7L * MILLISECONDS_PER_DAY))) {+ if (record.category() == null) {return true;}- if (duration > MILLISECONDS_PER_DAY) {- // remove everything else after 1 day- return true;++ final long created = record.created().getTime();+ final long duration = System.currentTimeMillis() - created;++ String cat = record.category();+ switch (cat) {+ case CATEGORY_WIKI_UPDATE:+ case CATEGORY_BLOG_ADD:+ case CATEGORY_PROFILE_UPDATE:+ if (duration > (3L * MILLISECONDS_PER_DAY)) {+ return true;+ }+ break;+ case CATEGORY_CRAWL_START:+ if (duration > (3L * MILLISECONDS_PER_DAY)) {+ final Seed seed = seedDB.get(record.originator());+ if (seed == null) return true; // TODO: shall we keep for 3 days without sender ?+ try {+ return (Integer.parseInt(seed.get(Seed.ISPEED, "-")) < 10); // TODO: should we keep longer as 3 days if peer is still/currently crawling (after 3 days) ?+ } catch (final NumberFormatException ee) {+ return true;+ }+ }+ break;+ case CATEGORY_TRANSLATION_ADD:+ case CATEGORY_TRANSLATION_VOTE_ADD:+ if (duration > (7L * MILLISECONDS_PER_DAY)) {+ return true;+ }+ break;+ default:+ if (duration > MILLISECONDS_PER_DAY) {+ // remove everything else after 1 day+ return true;+ }}return false;}