From 28670934bb60ecd4aa3dc95d65b8ca48084271fd Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 3 Oct 2019 00:05:17 -0400 Subject: [PATCH 1/4] Began testing --- dump.rdb | Bin 0 -> 1473 bytes example.js | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 dump.rdb diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 0000000000000000000000000000000000000000..7dc474506f75d2ffdf820d861a6f44146c594708 GIT binary patch literal 1473 zcmbu9UrZcz5Xa{bkiud6U?LbJYi&)N$ldMU|9dbbrO+le+G}l0w9NeO?guRF-O}AX z!b43#V>CWs+8Up#6070G)V>%^)Z|)UYV-x851Lx{{sSkHwiM*h>TlJ=f{8Kl<(J)= z*_qk-e&!e7-+S#4S_tti(yO}=NJ!Wv0PG~#_w_&3J8t+MDH7&*`Sb9w3u|T7Hkf|C^#W^$e zOxGdRG}X+Ir0K~~X;3$$5j`OVq(L>Kn!`NRYFaEgY8foaKkLm;0vvd9$1^+k8-{Mg zq&Ul@^t8l#+MA?M^x2FgK^L>6!&#o?p1%ru#tc2lO;g(Aeahs9+2LiHp_``H;A6V! zb$aVg=*&oYbKcewGo}P$0cG#bM{W18OAgpL?DF|+RBimq_IkT!6>|j@UF;r2!{_FqZL?>lA>%Pw`{zo23ZtZr?1$B7D&N zL}G*|El=*gaa`?`TQho!V_HvTHU9d+Hm{~8yk^o+$1L+$f3qBp#^lgm8wRE4T%Hr- z=h~B+$}^THt&j7gdf&`+o5vdF8IQrutY)otT(CP&Hikkm#c#V#et37A2Q4)@x{qmE zf<1KawmoXb;zovP-kGjOZ-!4;^l;CmyF!szcx`(N`1A3P)*8QCr8lcATS8BnK^5CU zsfw{i#cY>IzC~YFsl7ng!0#v}SMdjk7V%<%+z?&CGbO4)q=xHxih=(oK0Qz8ZWBOs z3EzNV5&Io&=L(d)fiEvok2CM*i>yD7=OI|TQu>*Cg`PDkg7PCiUdA~1E4XW!et~ce zcT{Lsl@LOraET@t*=!zTPKGH*dl9(1Nc|v}@o0(FM8@0f>pY!zVuWs;5E2=dX!%!? zm+347o$jN{cvdvNLh}$1aTWHeXlI=oKrW&94TsFoIyP)jeuE~~X|zZeZ{ofMYFwk^ zMZ5sA0HsdvEV9SS`0*crfgL}O+86ciC8Dv-P3 z|L@%WckJ9h_j-xFC}xWjRrZuU6|8`>nm6d%ReGh2hatR#OAh*T0{ue# z`z8l4O!|!hV4nxUR*Z=?k literal 0 HcmV?d00001 diff --git a/example.js b/example.js index 269ea1fc..6903bdd3 100644 --- a/example.js +++ b/example.js @@ -21,12 +21,13 @@ const run = () => { for (let i = 0; i <= 100; i++) { await sleep(Math.random()) job.progress(i) + console.log(job.delay) if (Math.random() * 200 < 1) throw new Error(`Random error ${i}`) } }) app.use('/add', (req, res) => { - example.add({ title: req.query.title }) + example.add({ title: req.query.title }, { delay: 100000 }) res.json({ ok: true }) }) From 1269d2c4a145c09c1906dbc7334ce238372290b8 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 3 Oct 2019 00:05:17 -0400 Subject: [PATCH 2/4] Began testing --- dump.rdb | Bin 0 -> 1473 bytes example.js | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 dump.rdb diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 0000000000000000000000000000000000000000..7dc474506f75d2ffdf820d861a6f44146c594708 GIT binary patch literal 1473 zcmbu9UrZcz5Xa{bkiud6U?LbJYi&)N$ldMU|9dbbrO+le+G}l0w9NeO?guRF-O}AX z!b43#V>CWs+8Up#6070G)V>%^)Z|)UYV-x851Lx{{sSkHwiM*h>TlJ=f{8Kl<(J)= z*_qk-e&!e7-+S#4S_tti(yO}=NJ!Wv0PG~#_w_&3J8t+MDH7&*`Sb9w3u|T7Hkf|C^#W^$e zOxGdRG}X+Ir0K~~X;3$$5j`OVq(L>Kn!`NRYFaEgY8foaKkLm;0vvd9$1^+k8-{Mg zq&Ul@^t8l#+MA?M^x2FgK^L>6!&#o?p1%ru#tc2lO;g(Aeahs9+2LiHp_``H;A6V! zb$aVg=*&oYbKcewGo}P$0cG#bM{W18OAgpL?DF|+RBimq_IkT!6>|j@UF;r2!{_FqZL?>lA>%Pw`{zo23ZtZr?1$B7D&N zL}G*|El=*gaa`?`TQho!V_HvTHU9d+Hm{~8yk^o+$1L+$f3qBp#^lgm8wRE4T%Hr- z=h~B+$}^THt&j7gdf&`+o5vdF8IQrutY)otT(CP&Hikkm#c#V#et37A2Q4)@x{qmE zf<1KawmoXb;zovP-kGjOZ-!4;^l;CmyF!szcx`(N`1A3P)*8QCr8lcATS8BnK^5CU zsfw{i#cY>IzC~YFsl7ng!0#v}SMdjk7V%<%+z?&CGbO4)q=xHxih=(oK0Qz8ZWBOs z3EzNV5&Io&=L(d)fiEvok2CM*i>yD7=OI|TQu>*Cg`PDkg7PCiUdA~1E4XW!et~ce zcT{Lsl@LOraET@t*=!zTPKGH*dl9(1Nc|v}@o0(FM8@0f>pY!zVuWs;5E2=dX!%!? zm+347o$jN{cvdvNLh}$1aTWHeXlI=oKrW&94TsFoIyP)jeuE~~X|zZeZ{ofMYFwk^ zMZ5sA0HsdvEV9SS`0*crfgL}O+86ciC8Dv-P3 z|L@%WckJ9h_j-xFC}xWjRrZuU6|8`>nm6d%ReGh2hatR#OAh*T0{ue# z`z8l4O!|!hV4nxUR*Z=?k literal 0 HcmV?d00001 diff --git a/example.js b/example.js index 269ea1fc..6903bdd3 100644 --- a/example.js +++ b/example.js @@ -21,12 +21,13 @@ const run = () => { for (let i = 0; i <= 100; i++) { await sleep(Math.random()) job.progress(i) + console.log(job.delay) if (Math.random() * 200 < 1) throw new Error(`Random error ${i}`) } }) app.use('/add', (req, res) => { - example.add({ title: req.query.title }) + example.add({ title: req.query.title }, { delay: 100000 }) res.json({ ok: true }) }) From 03a4fc6034557725c26dce71760a691cd93f5999 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 3 Oct 2019 00:29:52 -0400 Subject: [PATCH 3/4] Made progress Everything is done, except that the Delay category only shows the initial delay and doesn't currently update dynamically. --- dump.rdb | Bin 1473 -> 0 bytes example.js | 1 - routes/getDataForQeues.js | 1 + ui/components/Queue.js | 5 ++++- 4 files changed, 5 insertions(+), 2 deletions(-) delete mode 100644 dump.rdb diff --git a/dump.rdb b/dump.rdb deleted file mode 100644 index 7dc474506f75d2ffdf820d861a6f44146c594708..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1473 zcmbu9UrZcz5Xa{bkiud6U?LbJYi&)N$ldMU|9dbbrO+le+G}l0w9NeO?guRF-O}AX z!b43#V>CWs+8Up#6070G)V>%^)Z|)UYV-x851Lx{{sSkHwiM*h>TlJ=f{8Kl<(J)= z*_qk-e&!e7-+S#4S_tti(yO}=NJ!Wv0PG~#_w_&3J8t+MDH7&*`Sb9w3u|T7Hkf|C^#W^$e zOxGdRG}X+Ir0K~~X;3$$5j`OVq(L>Kn!`NRYFaEgY8foaKkLm;0vvd9$1^+k8-{Mg zq&Ul@^t8l#+MA?M^x2FgK^L>6!&#o?p1%ru#tc2lO;g(Aeahs9+2LiHp_``H;A6V! zb$aVg=*&oYbKcewGo}P$0cG#bM{W18OAgpL?DF|+RBimq_IkT!6>|j@UF;r2!{_FqZL?>lA>%Pw`{zo23ZtZr?1$B7D&N zL}G*|El=*gaa`?`TQho!V_HvTHU9d+Hm{~8yk^o+$1L+$f3qBp#^lgm8wRE4T%Hr- z=h~B+$}^THt&j7gdf&`+o5vdF8IQrutY)otT(CP&Hikkm#c#V#et37A2Q4)@x{qmE zf<1KawmoXb;zovP-kGjOZ-!4;^l;CmyF!szcx`(N`1A3P)*8QCr8lcATS8BnK^5CU zsfw{i#cY>IzC~YFsl7ng!0#v}SMdjk7V%<%+z?&CGbO4)q=xHxih=(oK0Qz8ZWBOs z3EzNV5&Io&=L(d)fiEvok2CM*i>yD7=OI|TQu>*Cg`PDkg7PCiUdA~1E4XW!et~ce zcT{Lsl@LOraET@t*=!zTPKGH*dl9(1Nc|v}@o0(FM8@0f>pY!zVuWs;5E2=dX!%!? zm+347o$jN{cvdvNLh}$1aTWHeXlI=oKrW&94TsFoIyP)jeuE~~X|zZeZ{ofMYFwk^ zMZ5sA0HsdvEV9SS`0*crfgL}O+86ciC8Dv-P3 z|L@%WckJ9h_j-xFC}xWjRrZuU6|8`>nm6d%ReGh2hatR#OAh*T0{ue# z`z8l4O!|!hV4nxUR*Z=?k diff --git a/example.js b/example.js index 6903bdd3..db65a097 100644 --- a/example.js +++ b/example.js @@ -21,7 +21,6 @@ const run = () => { for (let i = 0; i <= 100; i++) { await sleep(Math.random()) job.progress(i) - console.log(job.delay) if (Math.random() * 200 < 1) throw new Error(`Random error ${i}`) } }) diff --git a/routes/getDataForQeues.js b/routes/getDataForQeues.js index 7260987d..84620389 100644 --- a/routes/getDataForQeues.js +++ b/routes/getDataForQeues.js @@ -27,6 +27,7 @@ const formatJob = job => { finishedOn: job.finishedOn, progress: job._progress, attempts: job.attemptsMade, + delay: job.delay, failedReason: job.failedReason, stacktrace: job.stacktrace, opts: job.opts, diff --git a/ui/components/Queue.js b/ui/components/Queue.js index d559d47b..c6b51bf8 100644 --- a/ui/components/Queue.js +++ b/ui/components/Queue.js @@ -56,7 +56,7 @@ const statuses = [ const fields = { latest: ['id', 'timestamps', 'progress', 'attempts', 'data', 'opts'], completed: ['id', 'timestamps', 'progress', 'attempts', 'data', 'opts'], - delayed: ['id', 'timestamps', 'attempts', 'data', 'opts'], + delayed: ['id', 'timestamps', 'attempts', 'delay', 'data', 'opts'], paused: ['id', 'timestamps', 'attempts', 'data', 'opts'], active: ['id', 'timestamps', 'progress', 'attempts', 'data', 'opts'], waiting: ['id', 'timestamps', 'data', 'opts'], @@ -190,6 +190,9 @@ const fieldComponents = { attempts: ({ job }) => { return job.attempts }, + delay: ({ job }) => { + return job.delay + }, failedReason: ({ job }) => { return ( <> From 14d77d0c927dbc5179454ce4ef0eb65260c8e6ee Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Fri, 4 Oct 2019 09:28:27 -0400 Subject: [PATCH 4/4] Finished feature --- example.js | 2 +- ui/components/Queue.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example.js b/example.js index db65a097..269ea1fc 100644 --- a/example.js +++ b/example.js @@ -26,7 +26,7 @@ const run = () => { }) app.use('/add', (req, res) => { - example.add({ title: req.query.title }, { delay: 100000 }) + example.add({ title: req.query.title }) res.json({ ok: true }) }) diff --git a/ui/components/Queue.js b/ui/components/Queue.js index c6b51bf8..ff4bf9aa 100644 --- a/ui/components/Queue.js +++ b/ui/components/Queue.js @@ -191,7 +191,7 @@ const fieldComponents = { return job.attempts }, delay: ({ job }) => { - return job.delay + return job.timestamp + job.delay - Date.now() }, failedReason: ({ job }) => { return (