r7363 - in dumbhippo/trunk/server/src/com/dumbhippo/server: blocks impl



Author: marinaz
Date: 2008-03-13 13:24:28 -0500 (Thu, 13 Mar 2008)
New Revision: 7363

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/AbstractSingleBlockForFeedBlockHandlerBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FeedSystemBean.java
Log:
Stack a block only once for a batch of new feed entries for 
extrenal accounts for which we have a single block per feed, 
such as Twitter. This will prevent locks in transactions that
are run on commit, and will prevent us from publishing 
multiple user actions about the same Twitter update on 
Facebook. (This fix is similar to what we did for Last.fm 
in r7250.)  

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/AbstractSingleBlockForFeedBlockHandlerBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/AbstractSingleBlockForFeedBlockHandlerBean.java	2008-03-13 16:31:40 UTC (rev 7362)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/AbstractSingleBlockForFeedBlockHandlerBean.java	2008-03-13 18:24:28 UTC (rev 7363)
@@ -98,7 +98,9 @@
 	}
 
 	public void onExternalAccountFeedEntry(User user, ExternalAccount external, FeedEntry entry, int entryPosition) {
-		if (!external.hasLovedAndEnabledType(getAccountType()))
+		// the newest entry will have entryPosition 0; since we only have a single block for this feed,
+		// we want to restack it only once for each batch of new feed entries 
+		if (!external.hasLovedAndEnabledType(getAccountType()) || entryPosition != 0)
 			return;
 		// entry.getDate().getTime() creates a timestamp that is too old, at least with blogspot
 		// so it is unreliable, because we update blocks based on timestamps

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FeedSystemBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FeedSystemBean.java	2008-03-13 16:31:40 UTC (rev 7362)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FeedSystemBean.java	2008-03-13 18:24:28 UTC (rev 7363)
@@ -284,7 +284,7 @@
 			logger.warn("processFeedExternalAccounts called for TrackFeedEntry {}, but no accounts associated with feed", entry);
 		}		
 		
-		logger.debug("Processing external accounts for new feed entry {}", entry);
+		logger.debug("Processing external accounts for new feed entry {} entryPosition {}", entry, entryPosition);
 		
 		for (ExternalAccount external : entry.getFeed().getAccounts()) {
 			



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]