Skip to content

Commit 169bbfc

Browse files
committed
enhance example app
1 parent 1b2268a commit 169bbfc

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

example/App.tsx

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,34 @@ export default class App extends React.Component<IAppProps, IAppState> {
5656
<Button
5757
title='cancel Job'
5858
onPress={() => {
59-
if(this.state.jobId){
60-
queue.cancelJob(this.state.jobId, {message: 'Canceled'})
61-
} else {
62-
console.log("no job running");
63-
}
59+
if (this.state.jobId) {
60+
queue.cancelJob(this.state.jobId, { message: 'Canceled' })
61+
} else {
62+
console.log("no job running");
63+
}
64+
}}
65+
/>
66+
<Button
67+
title='remove failed Jobs'
68+
onPress={async () => {
69+
let jobs = await queue.getJobs();
70+
let jobRemovals = jobs.filter(job => job.failed !== '').map(async job => await queue.removeJob(job))
71+
await Promise.all(jobRemovals)
72+
}}
73+
/>
74+
<Button
75+
title='requeue failed Jobs'
76+
onPress={async () => {
77+
let jobs = await queue.getJobs();
78+
let jobRequeues = jobs.filter(job => job.failed !== '').map(async job => await queue.requeueJob(job))
79+
await Promise.all(jobRequeues)
80+
}}
81+
/>
82+
<Button
83+
title='getJobs'
84+
onPress={async () => {
85+
let jobs = await queue.getJobs();
86+
console.log(jobs)
6487
}}
6588
/>
6689
<Button

0 commit comments

Comments
 (0)