diff --git a/ts/textsecure/TaskWithTimeout.ts b/ts/textsecure/TaskWithTimeout.ts index d03dda2f771c..bd66375ea2a7 100644 --- a/ts/textsecure/TaskWithTimeout.ts +++ b/ts/textsecure/TaskWithTimeout.ts @@ -75,6 +75,9 @@ export default function createTaskWithTimeout>( entry.startedAt = Date.now(); timer = setTimeout(() => { if (complete) { + log.warn( + `TaskWithTimeout: ${id} task timed out, but was already complete` + ); return; } complete = true; @@ -93,8 +96,14 @@ export default function createTaskWithTimeout>( const entry: TaskType = { id, startedAt: undefined, - suspend: stopTimer, - resume: startTimer, + suspend: () => { + log.warn(`TaskWithTimeout: ${id} task suspended`); + stopTimer(); + }, + resume: () => { + log.warn(`TaskWithTimeout: ${id} task resumed`); + startTimer(); + }, }; tasks.add(entry);