r67528 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67527‎ | r67528 | r67529 >
Date:13:27, 7 June 2010
Author:daniel
Status:deferred
Tags:
Comment:
fixed automatic progress chunk intervals
Modified paths:
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/processor/ChunkedProgressRateTracker.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/processor/ChunkedProgressRateTracker.java
@@ -9,12 +9,14 @@
1010 import de.brightbyte.job.ProgressRateTracker;
1111
1212 public class ChunkedProgressRateTracker extends ProgressRateTracker {
13 - protected long counter = 0;
14 - protected long timestamp = 0;
 13+ protected long counter;
 14+ protected long timestamp;
1515 protected String name;
1616
1717 public ChunkedProgressRateTracker(String name) {
1818 this.name = name;
 19+ this.timestamp = System.currentTimeMillis();
 20+ this.counter = 0;
1921 }
2022
2123 public void step() {
@@ -34,8 +36,10 @@
3537 }
3638
3739 public boolean chunkIf(long counter, int sec) {
 40+ if (sec>0 && this.timestamp<=0) this.timestamp = System.currentTimeMillis();
 41+ long d = System.currentTimeMillis() - this.timestamp;
3842 if ((counter>0 && this.counter>=0 && this.counter >= counter)
39 - || (sec>0 && this.timestamp>0 && (System.currentTimeMillis() - this.timestamp)>sec*1000)) {
 43+ || (sec>0 && this.timestamp>0 && d>sec*1000)) {
4044 chunk();
4145 return true;
4246 } else {

Status & tagging log