Revision: 3817
Author: [email protected]
Date: Fri Jul 30 08:41:45 2010
Log: Somehow we sent a set of persist calls to the server that was empty
causing a divide by 0 error. In case this was a race condition that caused
the error the message length is recorded before it gets sent to the server
to avoid the chance of the message being cleared and we check that there is
a message length.
http://code.google.com/p/power-architect/source/detail?r=3817
Modified:
/trunk/src/main/java/ca/sqlpower/architect/enterprise/NetworkConflictResolver.java
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/enterprise/NetworkConflictResolver.java
Tue Jul 27 15:32:19 2010
+++
/trunk/src/main/java/ca/sqlpower/architect/enterprise/NetworkConflictResolver.java
Fri Jul 30 08:41:45 2010
@@ -175,6 +175,7 @@
}
MonitorableImpl monitor = null;
long startTimeMillis = System.currentTimeMillis();
+ long messageLength = messageBuffer.length();
try {
postingJSON.set(true);
@@ -237,8 +238,10 @@
throw new RuntimeException("Could not update current
revision" + e.getMessage());
}
long endTime = System.currentTimeMillis();
- double processTimePerObj = (endTime - startTimeMillis) /
messageBuffer.length();
- currentWaitPerPersist = currentWaitPerPersist * 0.9 +
processTimePerObj * 0.1;
+ if (messageLength != 0) {
+ double processTimePerObj = (endTime - startTimeMillis)
/ messageLength;
+ currentWaitPerPersist = currentWaitPerPersist * 0.9 +
processTimePerObj * 0.1;
+ }
} else {
// Did not successfully post json, we must update
ourselves, and then try again if we can.
if (!reflush) {