IDEMPIERE-3191:time to update performance gadget should use configuration

This commit is contained in:
hieplq 2016-09-16 12:47:07 +07:00
parent 506c0d063d
commit fa8188043c
2 changed files with 10 additions and 2 deletions

View File

@ -30,7 +30,6 @@ import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.TimeUtil;
/**
* Performance Goal
@ -373,9 +372,17 @@ public class MGoal extends X_PA_Goal
{
if (log.isLoggable(Level.CONFIG)) log.config("Force=" + force);
MMeasure measure = MMeasure.get(getCtx(), getPA_Measure_ID());
boolean isUpdateByInterfal = false;
if (getDateLastRun() != null){
// default 30 minute 1800000
long interval = MSysConfig.getIntValue(MSysConfig.ZK_DASHBOARD_PERFORMANCE_REFRESH_INTERVAL, 1800000);
isUpdateByInterfal = (System.currentTimeMillis() - getDateLastRun().getTime()) > interval;
}
if (force
|| getDateLastRun() == null
|| !TimeUtil.isSameHour(getDateLastRun(), null))
|| isUpdateByInterfal)
{
measure.set_TrxName(get_TrxName());
if (measure.updateGoals()) // saves

View File

@ -147,6 +147,7 @@ public class MSysConfig extends X_AD_SysConfig
public static final String ZK_BUTTON_STYLE = "ZK_BUTTON_STYLE";
public static final String ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE = "ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE";
public static final String ZK_DASHBOARD_PERFORMANCE_TIMEOUT = "ZK_DASHBOARD_PERFORMANCE_TIMEOUT";
public static final String ZK_DASHBOARD_PERFORMANCE_REFRESH_INTERVAL = "ZK_DASHBOARD_PERFORMANCE_REFRESH_INTERVAL";
public static final String ZK_DASHBOARD_REFRESH_INTERVAL = "ZK_DASHBOARD_REFRESH_INTERVAL";
public static final String ZK_DECIMALBOX_PROCESS_DOTKEYPAD = "ZK_DECIMALBOX_PROCESS_DOTKEYPAD";
public static final String ZK_DESKTOP_CLASS = "ZK_DESKTOP_CLASS";