(taskId, startedAt)
| 75 | } |
| 76 | |
| 77 | recordComplete(taskId, startedAt) { |
| 78 | this._stats.tasks_completed++; |
| 79 | this._stats.last_complete_at = Date.now(); |
| 80 | if (startedAt) { |
| 81 | const duration = Date.now() - startedAt; |
| 82 | this._stats._completion_times.push(duration); |
| 83 | if (this._stats._completion_times.length > 100) { |
| 84 | this._stats._completion_times.shift(); |
| 85 | } |
| 86 | const sum = this._stats._completion_times.reduce((a, b) => a + b, 0); |
| 87 | this._stats.avg_completion_ms = Math.round(sum / this._stats._completion_times.length); |
| 88 | } |
| 89 | this.store.setState('task_monitor_stats', JSON.stringify(this.getMetrics())); |
| 90 | } |
| 91 | |
| 92 | recordFailed(taskId) { |
| 93 | this._stats.tasks_failed++; |
no test coverage detected