Revision: 4755
          http://sourceforge.net/p/vexi/code/4755
Author:   mkpg2
Date:     2015-01-13 04:38:07 +0000 (Tue, 13 Jan 2015)
Log Message:
-----------
Hot replace optimisation. Avoid over checking as this can be slow if a template 
is repeatedly accessed.

Modified Paths:
--------------
    branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/Blessing.java

Modified: 
branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/Blessing.java
===================================================================
--- branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/Blessing.java 
2014-11-26 06:38:08 UTC (rev 4754)
+++ branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/Blessing.java 
2015-01-13 04:38:07 UTC (rev 4755)
@@ -139,7 +139,11 @@
         return f.getTimestamp();
     }
     
+    // DEV only
     private long oldtimestamp = -2;
+    private long lastCheck = -2;
+    
+    
     private void resolve() throws JSExn {
         // Otherwise we recurse infinitely.
         if (initializing) {
@@ -150,12 +154,19 @@
             // FEATURE: Might want to handle the ".t" part better
             JS res = (parent==null) ? this : parent.getTemplateRes(parentkey);
             if (Main.hotreplace) {
+               long tnow = System.currentTimeMillis();
+               // Avoid checking more than once every 2 seconds. On some 
systems checking can be
+               // slow and this is bad when repeatedly loading the same 
template
+               if(tnow-lastCheck<2000) return;
+
+               
                 long timestamp = getTimestamp(res);
                 if (static_!=null) {
                     if (timestamp==oldtimestamp) {
-                        return;
+                       lastCheck = tnow;
+                       return;
                     } else {
-                        Log.system.warn(Blessing.class, "hot replace: "+res);
+                       Log.system.warn(Blessing.class, "hot replace: "+res);
                     }
                 }
                 oldtimestamp = timestamp;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to