document-dataply 0.0.10-alpha.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js
CHANGED
|
@@ -11789,7 +11789,7 @@ var DeadlineChunker = class {
|
|
|
11789
11789
|
* EWMA 평활화 계수
|
|
11790
11790
|
*/
|
|
11791
11791
|
alpha;
|
|
11792
|
-
constructor(targetMs =
|
|
11792
|
+
constructor(targetMs = 5) {
|
|
11793
11793
|
this.targetMs = targetMs;
|
|
11794
11794
|
this.chunkSize = 50;
|
|
11795
11795
|
this.ewmaMs = null;
|
|
@@ -11798,14 +11798,14 @@ var DeadlineChunker = class {
|
|
|
11798
11798
|
/**
|
|
11799
11799
|
* EWMA 평활화 계수를 사용하여 평균 처리 시간을 업데이트합니다.
|
|
11800
11800
|
*/
|
|
11801
|
-
|
|
11801
|
+
updateEstimate(elapsed, count) {
|
|
11802
11802
|
const msPerItem = elapsed / count;
|
|
11803
11803
|
this.ewmaMs = this.ewmaMs === null ? msPerItem : this.alpha * msPerItem + (1 - this.alpha) * this.ewmaMs;
|
|
11804
11804
|
}
|
|
11805
11805
|
/**
|
|
11806
11806
|
* 현재 chunk size를 업데이트합니다.
|
|
11807
11807
|
*/
|
|
11808
|
-
|
|
11808
|
+
nextChunkSize() {
|
|
11809
11809
|
if (!this.ewmaMs || this.ewmaMs === 0) return this.chunkSize;
|
|
11810
11810
|
const next = Math.floor(this.targetMs / this.ewmaMs);
|
|
11811
11811
|
return Math.max(1, Math.min(next, 5e3));
|
|
@@ -11818,13 +11818,14 @@ var DeadlineChunker = class {
|
|
|
11818
11818
|
let len = items.length;
|
|
11819
11819
|
while (i < len) {
|
|
11820
11820
|
const chunk = items.slice(i, i + this.chunkSize);
|
|
11821
|
+
const count = chunk.length;
|
|
11821
11822
|
const start = performance.now();
|
|
11822
11823
|
await processFn(chunk);
|
|
11823
11824
|
const elapsed = performance.now() - start;
|
|
11824
|
-
this.
|
|
11825
|
-
this.chunkSize = this.
|
|
11826
|
-
i +=
|
|
11827
|
-
await new Promise(
|
|
11825
|
+
this.updateEstimate(elapsed, count);
|
|
11826
|
+
this.chunkSize = this.nextChunkSize();
|
|
11827
|
+
i += count;
|
|
11828
|
+
await new Promise(setImmediate);
|
|
11828
11829
|
}
|
|
11829
11830
|
}
|
|
11830
11831
|
};
|
|
@@ -22,11 +22,11 @@ export declare class DeadlineChunker {
|
|
|
22
22
|
/**
|
|
23
23
|
* EWMA 평활화 계수를 사용하여 평균 처리 시간을 업데이트합니다.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
private updateEstimate;
|
|
26
26
|
/**
|
|
27
27
|
* 현재 chunk size를 업데이트합니다.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
private nextChunkSize;
|
|
30
30
|
/**
|
|
31
31
|
* 주어진 items를 chunk로 분할하여 처리합니다.
|
|
32
32
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-dataply",
|
|
3
|
-
"version": "0.0.10
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Simple and powerful JSON document database supporting complex queries and flexible indexing policies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "izure <admin@izure.org>",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"croner": "^10.0.1",
|
|
46
|
-
"dataply": "^0.0.25
|
|
46
|
+
"dataply": "^0.0.25"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/jest": "^30.0.0",
|
|
50
50
|
"esbuild": "^0.27.3",
|
|
51
|
-
"jest": "^30.
|
|
51
|
+
"jest": "^30.3.0",
|
|
52
52
|
"ts-jest": "^29.4.6",
|
|
53
53
|
"typescript": "^5.9.3"
|
|
54
54
|
}
|