优化数据源导出
This commit is contained in:
@@ -37,7 +37,8 @@ public class TabOrderExportAsyncRunner
|
|||||||
public static final String CACHE_KEY_PREFIX = "monitor:orderSource:export:task:";
|
public static final String CACHE_KEY_PREFIX = "monitor:orderSource:export:task:";
|
||||||
public static final int TTL_MINUTES = 60;
|
public static final int TTL_MINUTES = 60;
|
||||||
public static final String REL_DIR = "orderSourceExport";
|
public static final String REL_DIR = "orderSourceExport";
|
||||||
public static final int PAGE_SIZE = 500;
|
/** Must stay <= TabOrderMonitorService.normalizePage max (200). */
|
||||||
|
public static final int PAGE_SIZE = 200;
|
||||||
/** 单次导出行数上限(防 OOM) */
|
/** 单次导出行数上限(防 OOM) */
|
||||||
public static final int EXPORT_MAX = 20000;
|
public static final int EXPORT_MAX = 20000;
|
||||||
|
|
||||||
@@ -103,7 +104,9 @@ public class TabOrderExportAsyncRunner
|
|||||||
int pct = Math.min(70, 5 + (int) ((all.size() * 65L) / Math.max(total, 1L)));
|
int pct = Math.min(70, 5 + (int) ((all.size() * 65L) / Math.max(total, 1L)));
|
||||||
put(taskId, TabOrderExportTask.STATUS_RUNNING, pct, "querying " + all.size() + "/" + total,
|
put(taskId, TabOrderExportTask.STATUS_RUNNING, pct, "querying " + all.size() + "/" + total,
|
||||||
null, fileName, null, all.size());
|
null, fileName, null, all.size());
|
||||||
if (all.size() >= total || rows.size() < PAGE_SIZE || all.size() >= EXPORT_MAX)
|
// Do not compare rows.size() to PAGE_SIZE: searchPage caps pageSize at 200.
|
||||||
|
// Stop only when all matched rows are collected or hard limit hit.
|
||||||
|
if (all.size() >= total || all.size() >= EXPORT_MAX)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user