Skip to content

Commit

Permalink
try wrapping and completing task
Browse files Browse the repository at this point in the history
  • Loading branch information
mythilytm committed Nov 14, 2024
1 parent 9f4175d commit 4ebb600
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions functions/completeTaskAssignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
success,
functionValidator as TokenValidator,
} from '@tech-matters/serverless-helpers';
import { set } from 'lodash';

Check failure on line 28 in functions/completeTaskAssignment.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

'set' is defined but never used

type EnvVars = {
TWILIO_WORKSPACE_SID: string;
Expand Down Expand Up @@ -75,7 +76,7 @@ const closeTaskAssignment = async (
// const conversationSid = attributes?.conversation_sid;

// Ends the task for the worker and client for chat tasks, and only for the worker for voice tasks
const wrappingTask = await task.update({
await task.update({
assignmentStatus: 'wrapping',
attributes: event.finalTaskAttributes,
});
Expand All @@ -85,8 +86,13 @@ const closeTaskAssignment = async (
.fetch();
console.log(`Task ${aftertask} with attributes ${aftertask.attributes} has been completed`);
if (callSid) await client.calls(callSid).update({ status: 'completed' });

return { type: 'success', completedTask: wrappingTask } as const;
setTimeout(() => {
console.log('This will be executed in 10sec');
}, 10000);
const completedTask = await task.update({
assignmentStatus: 'completed',
});
return { type: 'success', completedTask } as const;
} catch (err) {
return {
type: 'error',
Expand Down

0 comments on commit 4ebb600

Please sign in to comment.