From fb0aeb0fc9e33fa8476f5dea9729a6e5cdc2c506 Mon Sep 17 00:00:00 2001 From: jayce1116 Date: Thu, 24 Aug 2023 13:34:06 +0900 Subject: [PATCH] =?UTF-8?q?ActionTriggerTimout=EB=A5=BC=20actionWorkItem?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=9D=BC=EA=B4=84=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD=20(#1075)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ###Description - `ActionTriggerTimout`를 actionWorkItem으로 일괄 관리하도록 변경 --- .../Sources/CapabilityAgents/Routine/RoutineExecuter.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NuguAgents/Sources/CapabilityAgents/Routine/RoutineExecuter.swift b/NuguAgents/Sources/CapabilityAgents/Routine/RoutineExecuter.swift index 80f58e6c..77d7ed79 100644 --- a/NuguAgents/Sources/CapabilityAgents/Routine/RoutineExecuter.swift +++ b/NuguAgents/Sources/CapabilityAgents/Routine/RoutineExecuter.swift @@ -351,9 +351,12 @@ private extension RoutineExecuter { if let actionTimeout = action.actionTimeoutInMilliseconds, .zero < actionTimeout { state = .suspended - DispatchQueue.global().asyncAfter(deadline: .now() + NuguTimeInterval(milliseconds: actionTimeout).seconds) { [weak self] in + + let workItem = DispatchWorkItem { [weak self] in self?.delegate?.routineExecuterShouldSendActionTriggerTimout(token: action.token) } + actionWorkItem = workItem + routineDispatchQueue.asyncAfter(deadline: .now() + NuguTimeInterval(milliseconds: actionTimeout).seconds, execute: workItem) } log.debug(action.type)