r7412 - dumbhippo/trunk/server/src/com/dumbhippo/server/applications



Author: otaylor
Date: 2008-04-08 15:58:26 -0500 (Tue, 08 Apr 2008)
New Revision: 7412

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/server/applications/ApplicationSystemBean.java
Log:
When the user uploads new application usage, invalidate
 topApplications and applicationUsageStart.


Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/applications/ApplicationSystemBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/applications/ApplicationSystemBean.java	2008-04-08 14:34:57 UTC (rev 7411)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/applications/ApplicationSystemBean.java	2008-04-08 20:58:26 UTC (rev 7412)
@@ -37,6 +37,7 @@
 import com.dumbhippo.GlobalSetup;
 import com.dumbhippo.TypeUtils;
 import com.dumbhippo.XmlBuilder;
+import com.dumbhippo.dm.ReadWriteSession;
 import com.dumbhippo.identity20.Guid;
 import com.dumbhippo.persistence.AppinfoUpload;
 import com.dumbhippo.persistence.Application;
@@ -674,6 +675,17 @@
 		for (ApplicationUsageProperties props : usages) {
 			recordApplicationUsage(viewpoint, props, now);
 		}
+
+		/* This is somewhat expensive since if the user is listening for changes to topApplications
+		 * it will result in topApplications immediately being recomputed and sent to the user
+		 * each time the use uploads new application stats (basically once an hour.)
+		 * If it proves that computing topApplications once an hour for everybody is too much
+		 * work we might want to consider keeping track of when we last computed it and only
+		 * notify changes once a day.
+		 */
+		ReadWriteSession session = DataService.currentSessionRW(); 
+		session.changed(UserDMO.class, viewpoint.getViewer().getGuid(), "topApplications");
+		session.changed(UserDMO.class, viewpoint.getViewer().getGuid(), "applicationUsageStart");
 	}
 
 	private void recordApplicationUsage(UserViewpoint viewpoint, ApplicationUsageProperties props, Date date) {



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