Skip to content

Commit 80dac59

Browse files
author
usbsync
committed
getObjectsBlocksForEventThread 오래 걸릴때 개수 안나오는 경우 수정 처리
1 parent 0e5d1b2 commit 80dac59

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

src/util/utils.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,25 +2418,31 @@ Entry.Utils.getObjectsBlocksBySceneId = _.memoize((sceneId) => {
24182418
});
24192419

24202420
Entry.Utils.getObjectsBlocksForEventThread = _.memoize((object) => {
2421+
const nowScheduler = new Scheduler();
24212422
const _typePicker = _.partial(_.result, _, 'type');
24222423
const job = new Promise((resolve) => {
2423-
scheduler.run(function*() {
2424+
nowScheduler.run(function*() {
24242425
const result = [];
2425-
let codes;
2426-
if (object) {
2427-
codes = [object];
2428-
} else {
2429-
codes = Entry.container.objects_;
2430-
}
2431-
for (const code of codes) {
2432-
let script = code.script;
2433-
if (!(script instanceof Entry.Code)) {
2434-
script = new Entry.Code(script);
2426+
try {
2427+
let codes;
2428+
if (object) {
2429+
codes = [object];
2430+
} else {
2431+
codes = Entry.container.objects_;
24352432
}
2436-
result.push(script.getBlockListForEventThread(true).map(_typePicker));
2437-
yield;
2433+
for (const code of codes) {
2434+
let script = code.script;
2435+
if (!(script instanceof Entry.Code)) {
2436+
script = new Entry.Code(script);
2437+
}
2438+
result.push(script.getBlockListForEventThread(true).map(_typePicker));
2439+
yield;
2440+
}
2441+
resolve(_.flatten(result));
2442+
} catch (e) {
2443+
console.warn(e);
2444+
resolve(_.flatten(result));
24382445
}
2439-
resolve(_.flatten(result));
24402446
});
24412447
});
24422448
return job;

0 commit comments

Comments
 (0)