diff --git a/updates_and_signals/safe_message_handlers/src/activities.ts b/updates_and_signals/safe_message_handlers/src/activities.ts index f5c8e98f..1e2399f0 100644 --- a/updates_and_signals/safe_message_handlers/src/activities.ts +++ b/updates_and_signals/safe_message_handlers/src/activities.ts @@ -1,3 +1,5 @@ +import * as activities from '@temporalio/activity'; + interface AssignNodesToJobInput { nodes: string[]; jobName: string; @@ -9,20 +11,16 @@ interface UnassignNodesForJobInput { } export async function startCluster(): Promise { - console.log('Starting cluster'); - await sleep(100); // Simulate RPC + activities.log.info('Starting cluster'); + await activities.sleep(100); // Simulate RPC } export async function assignNodesToJob(input: AssignNodesToJobInput): Promise { - console.log(`Assigning nodes ${input.nodes} to job ${input.jobName}`); - await sleep(100); // Simulate RPC + activities.log.info(`Assigning nodes ${input.nodes} to job ${input.jobName}`); + await activities.sleep(100); // Simulate RPC } export async function unassignNodesForJob(input: UnassignNodesForJobInput): Promise { - console.log(`Unassigning nodes ${input.nodes} from job ${input.jobName}`); - await sleep(100); // Simulate RPC -} - -async function sleep(ms: number): Promise { - await new Promise((resolve) => setTimeout(resolve, ms)); + activities.log.info(`Unassigning nodes ${input.nodes} from job ${input.jobName}`); + await activities.sleep(100); // Simulate RPC }