que-web 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/que/web/sql.rb +4 -0
- data/lib/que/web.rb +17 -5
- data/que-web.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e53a5fe5f561cbf449575e05ad141345204277b
|
4
|
+
data.tar.gz: 1af28bcab33f8059756d23ea09c1f02a8ff9076e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2652924191d5f36e784f792667f8f46c5e0dc656dc6116125f1283bff1d021e9969dfb75e3551f9bc4c15c58136036faa191f0fe6153cbc3d323dc690abe146c
|
7
|
+
data.tar.gz: b6d717da60ddc3156fc4b9fed6c26578dd643a4e0a864ab8d06c1b12e361db4593823a4bbc673c3528feb6d64fc539836b5c9c1308ae52137c7920546709d729
|
data/README.md
CHANGED
@@ -4,6 +4,11 @@ que-web is a web UI to the [Que](https://github.com/chanks/que) job queue.
|
|
4
4
|
|
5
5
|

|
6
6
|
|
7
|
+
|
8
|
+
<a target='_blank' rel='nofollow' href='https://app.codesponsor.io/link/AitzkUqcdsSnujfFtmVhTLXR/statianzo/que-web'>
|
9
|
+
<img alt='Sponsor' width='888' height='68' src='https://app.codesponsor.io/embed/AitzkUqcdsSnujfFtmVhTLXR/statianzo/que-web.svg' />
|
10
|
+
</a>
|
11
|
+
|
7
12
|
## Installation
|
8
13
|
|
9
14
|
Add this line to your application's Gemfile:
|
data/lib/que/web/sql.rb
CHANGED
@@ -43,11 +43,15 @@ Que::Web::SQL = {
|
|
43
43
|
DELETE
|
44
44
|
FROM que_jobs
|
45
45
|
WHERE job_id = $1::bigint
|
46
|
+
AND pg_try_advisory_lock($1::bigint)
|
47
|
+
RETURNING job_id
|
46
48
|
SQL
|
47
49
|
reschedule_job: <<-SQL.freeze,
|
48
50
|
UPDATE que_jobs
|
49
51
|
SET run_at = $2::timestamptz
|
50
52
|
WHERE job_id = $1::bigint
|
53
|
+
AND pg_try_advisory_lock($1::bigint)
|
54
|
+
RETURNING job_id
|
51
55
|
SQL
|
52
56
|
fetch_job: <<-SQL.freeze,
|
53
57
|
SELECT *
|
data/lib/que/web.rb
CHANGED
@@ -62,10 +62,16 @@ module Que
|
|
62
62
|
job_id = id.to_i
|
63
63
|
if job_id > 0
|
64
64
|
run_at = Time.now
|
65
|
-
Que.execute SQL[:reschedule_job], [job_id, run_at]
|
66
|
-
set_flash "info", "Job #{job_id} rescheduled for #{run_at}"
|
67
|
-
end
|
68
65
|
|
66
|
+
updated_rows = Que.execute SQL[:reschedule_job], [job_id, run_at]
|
67
|
+
|
68
|
+
if updated_rows.empty?
|
69
|
+
# Didn't get the advisory lock
|
70
|
+
set_flash "warning", "Job #{job_id} not rescheduled as it was already runnning"
|
71
|
+
else
|
72
|
+
set_flash "info", "Job #{job_id} rescheduled for #{run_at}"
|
73
|
+
end
|
74
|
+
end
|
69
75
|
|
70
76
|
redirect request.referrer, 303
|
71
77
|
end
|
@@ -73,8 +79,14 @@ module Que
|
|
73
79
|
delete "/jobs/:id" do |id|
|
74
80
|
job_id = id.to_i
|
75
81
|
if job_id > 0
|
76
|
-
Que.execute SQL[:delete_job], [job_id]
|
77
|
-
|
82
|
+
updated_rows = Que.execute SQL[:delete_job], [job_id]
|
83
|
+
|
84
|
+
if updated_rows.empty?
|
85
|
+
# Didn't get the advisory lock
|
86
|
+
set_flash "warning", "Job #{job_id} not deleted as it was already runnning"
|
87
|
+
else
|
88
|
+
set_flash "info", "Job #{job_id} deleted"
|
89
|
+
end
|
78
90
|
end
|
79
91
|
|
80
92
|
redirect request.referrer, 303
|
data/que-web.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "que-web"
|
7
|
-
spec.version = "0.
|
7
|
+
spec.version = "0.6.0"
|
8
8
|
spec.authors = ["Jason Staten"]
|
9
9
|
spec.email = ["jstaten07@gmail.com"]
|
10
10
|
spec.summary = %q{A web interface for the que queue}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: que-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Staten
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: que
|