Changeset 4123


Ignore:
Timestamp:
Feb 4, 2008, 1:32:08 PM (15 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #917: The progress reporter for a job should update the database if the progress is increased with >= 5%

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Job.java

    r4095 r4123  
    12711271    */
    12721272    private static final long UPDATE_INTERVAL = 5 * 1000;
     1273
     1274    /**
     1275      Min percentage difference between updates to the database.
     1276    */
     1277    private static final int UPDATE_PERCENT = 5;
    12731278   
    12741279    private final SessionControl sc;
     
    13011306    public void display(int percent, String message)
    13021307    {
    1303       // Do not update unless at least some time has passed, or the plug-in has finished
    1304       if (System.currentTimeMillis() - lastUpdate > UPDATE_INTERVAL || percent == 100)
     1308      // Do not update unless at least :
     1309      // * some time has passed
     1310      // * the plug-in has finished (percent == 100)
     1311      // * progress has increased by at least 5%
     1312      if (System.currentTimeMillis() - lastUpdate >= UPDATE_INTERVAL ||
     1313          percent == 100 || percent - lastValue >= UPDATE_PERCENT)
    13051314      {
    13061315        // If the percent is negative and less then the last value, an offset will be calculated.
Note: See TracChangeset for help on using the changeset viewer.