종료 시 'Tray is destroyed' 오류 창: 트레이 · 상태 갱신 타이머를 멈추고 트레이를 비운 뒤 없앤다 · Electron 이 먼저 없앤 트레이도 건드리지 않음 · 종료 중 STT 는 새 작업을 꺼내지 않고 워커 종료로 실패한 작업을 닫힌 DB 에 기록하지 않음 (시험 추가)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -189,6 +189,7 @@ export async function startCore(opts: CoreOptions) {
|
||||
relay.stop();
|
||||
retention.stop();
|
||||
games.stop();
|
||||
stt.stop();
|
||||
await bot.stop();
|
||||
await worker.stop();
|
||||
await api.close();
|
||||
|
||||
@@ -81,6 +81,8 @@ export class SttPipeline {
|
||||
private queued = new Set<string>();
|
||||
private busy = false;
|
||||
private processing: string | null = null;
|
||||
/** 앱 종료 중: 새 작업을 꺼내지 않고, 워커가 끊겨 실패한 작업은 DB(곧 닫힘)에 기록하지 않는다. 남은 발화는 다음 시작 때 다시 처리 */
|
||||
private stopped = false;
|
||||
/** 한 발화의 변환이 끝났을 때 (녹음 파일 이름 맞추기) */
|
||||
onDone: ((id: string) => void) | null = null;
|
||||
/** 예전 녹음 고치기가 끝났을 때 */
|
||||
@@ -238,8 +240,13 @@ export class SttPipeline {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** 종료 시작 (워커 · DB 를 닫기 전에 부른다) */
|
||||
stop(): void {
|
||||
this.stopped = true;
|
||||
}
|
||||
|
||||
private pump(): void {
|
||||
if (this.busy || !this.worker.ready) return;
|
||||
if (this.stopped || this.busy || !this.worker.ready) return;
|
||||
const idx = this.queue.findIndex((j) => this.pickSlot(j) !== null);
|
||||
if (idx < 0) return;
|
||||
const job = this.queue.splice(idx, 1)[0];
|
||||
@@ -254,6 +261,7 @@ export class SttPipeline {
|
||||
this.busy = false;
|
||||
this.processing = null;
|
||||
this.status.processing = null;
|
||||
if (this.stopped) return;
|
||||
try {
|
||||
if (!this.isBusy(job.id)) this.onDone?.(job.id);
|
||||
} catch (e) {
|
||||
@@ -320,6 +328,7 @@ export class SttPipeline {
|
||||
5 * 60000,
|
||||
);
|
||||
} catch (e: any) {
|
||||
if (this.stopped) return;
|
||||
const attempts = this.store.bumpAttempt(u.id);
|
||||
this.status.lastError = e.message;
|
||||
log.warn(`STT 실패 (${u.id}, ${attempts}회): ${e.message}`);
|
||||
|
||||
Reference in New Issue
Block a user