TimerTask interface
DurableClient반환됩니다. 호출이 -ed가 아닌 경우createTimer(Date)yield. 보류 중인 타이머를 나타냅니다. 자세한 내용은 작업 설명서를 참조하세요.
오케스트레이션이 완료되려면 보류 중인 모든 타이머를 완료하거나 취소해야 합니다.
예제
타이머 취소
// calculate expiration date
const timeoutTask = context.df.createTimer(expirationDate);
// do some work
if (!timeoutTask.isCompleted) {
// An orchestration won't get marked as completed until all its scheduled
// tasks have returned, or been cancelled. Therefore, it is important
// to cancel timers when they're no longer needed
timeoutTask.cancel();
}
예제
시간 제한 만들기
const now = Date.now();
const expiration = new Date(now.valueOf()).setMinutes(now.getMinutes() + 30);
const timeoutTask = context.df.createTimer(expirationDate);
const otherTask = context.df.callActivity("DoWork");
const winner = yield context.df.Task.any([timeoutTask, otherTask]);
if (winner === otherTask) {
// do some more work
}
if (!timeoutTask.isCompleted) {
// An orchestration won't get marked as completed until all its scheduled
// tasks have returned, or been cancelled. Therefore, it is important
// to cancel timers when they're no longer needed
timeoutTask.cancel();
}
- Extends
속성
| cancel | 타이머를 취소해야 임을 나타냅니다. 이 요청은 다음 |
| is |
상속된 속성
| is |
작업이 완료되었는지 여부입니다. 완료는 성공과 동일하지 않습니다. |
| is |
오류로 인해 어떤 방식으로든 태스크에 오류가 발생했는지 여부입니다. |
| result | 작업이 완료된 경우의 결과입니다. 그렇지 않으면 |
속성 세부 정보
cancel
타이머를 취소해야 임을 나타냅니다. 이 요청은 다음 yield 또는 return 문에서 실행됩니다.
cancel: () => void
속성 값
() => void
isCanceled
isCanceled: boolean
속성 값
boolean
타이머가 취소되었는지 여부입니다.