* @brief Cancel a transcription task by ID * * @param data [in] Task cancellation parameters: * - objid [BigInt] Task identifier to cancel * * @return SQL result object containing: * - rowsAffected: Number of tasks cancelled * - recordset: Updated task record * * @throws Error if canc
(data)
| 184 | * @note Only cancels tasks that aren't completed |
| 185 | */ |
| 186 | async function cancel_task(data) { |
| 187 | const query_cancel_task = TASK_QUERIES.CANCEL_TASK; |
| 188 | try { |
| 189 | const pool = await pool_promise; |
| 190 | const result = await pool.request() |
| 191 | .input('objid', sql.BigInt, data.objid) |
| 192 | .query(query_cancel_task); |
| 193 | |
| 194 | return result |
| 195 | } catch (err) { |
| 196 | logger(LOG_LEVEL.ERROR, `cancel_task ${err}.`); |
| 197 | throw err; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * @brief Clean up abandoned or stale tasks in the system |
no test coverage detected