From 401c85df0a2ba5ebd43a6363028cbb68c6c7ffaf Mon Sep 17 00:00:00 2001 From: James Greenaway Date: Tue, 29 Jan 2019 10:19:30 +0000 Subject: [PATCH] Impove workload failure/success flipping and update demos --- src/index.tsx | 15 +++++++++++---- src/state/workloads/services.ts | 6 +++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index f55a152..5ad976d 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -29,11 +29,18 @@ store.dispatch(WorkloadActions.updateStatus({ id: 0, status: 'SUCCESS' })); const workloadService = new WorkloadService(); -workloadService.create({ complexity: 100 }).then(console.log.bind(console, 'create')); -workloadService.cancel({ id: 0 }).then(console.log.bind(console, 'cancel')); +workloadService.create({ complexity: 1 }).then(console.log.bind(console, 'create 0')); +workloadService.cancel({ id: 0 }).then(console.log.bind(console, 'cancel 0')); +setTimeout(() => workloadService.checkStatus({ id: 0 }).then(console.log.bind(console, 'checkStatus 0')), 100) + +workloadService.create({ complexity: 2 }).then(console.log.bind(console, 'create 1')); +workloadService.checkStatus({ id: 1 }).then(console.log.bind(console, 'checkStatus 1')); +setTimeout(() => workloadService.checkStatus({ id: 1 }).then(console.log.bind(console, 'checkStatus 1')), 200) + +workloadService.create({ complexity: 2 }).then(console.log.bind(console, 'create 2')); +workloadService.checkStatus({ id: 2 }).then(console.log.bind(console, 'checkStatus 2')); +setTimeout(() => workloadService.checkStatus({ id: 2 }).then(console.log.bind(console, 'checkStatus 2')), 200) -workloadService.create({ complexity: 200 }).then(console.log.bind(console, 'create')); -workloadService.checkStatus({ id: 1 }).then(console.log.bind(console, 'checkStatus')); ReactDOM.render( diff --git a/src/state/workloads/services.ts b/src/state/workloads/services.ts index 303f339..6b17b8a 100644 --- a/src/state/workloads/services.ts +++ b/src/state/workloads/services.ts @@ -14,9 +14,9 @@ export class WorkloadService { } private completeWorkload(work: Work) { - work.status = this.counter % 2 - ? 'SUCCESS' - : 'FAILURE'; + work.status = work.id % 2 + ? 'FAILURE' + : 'SUCCESS'; }