tanga_que_extensions 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/que_job.rb +5 -0
- data/lib/que_job_status.rb +6 -0
- data/lib/record_job_status.rb +1 -1
- data/test/test.rb +13 -11
- 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: bf1cafc0e3aca49b8e02bf055351a71c7a0a2ce6
|
4
|
+
data.tar.gz: 2e7d21483460f8954618ff9ad2735f58aa39f40c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29c5baddb1020bdb3e9c5a9219dcc20ba05591a8d4a64f3f891eff7267590f725e3f939df57e80c76df707792d86569cd0e0903fe35b2000b2762f0da5a4baaa
|
7
|
+
data.tar.gz: 120b45d9f7b353b5348700e9c067a6750bbb687f98efd87d90daed0ba5e03be374b32013d10277be28a837899959fa773b7864816448a2a429e98842cf37d49b
|
data/lib/que_job.rb
CHANGED
data/lib/que_job_status.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
1
|
class QueJobStatus < ActiveRecord::Base
|
2
2
|
self.table_name = :que_job_status
|
3
|
+
|
4
|
+
def self.raw_job_data(job_id)
|
5
|
+
query = ['SELECT status, job_data from que_job_status where job_id = ?', job_id]
|
6
|
+
sanitized = sanitize_sql_array(query)
|
7
|
+
connection.execute(sanitized).first
|
8
|
+
end
|
3
9
|
end
|
data/lib/record_job_status.rb
CHANGED
data/test/test.rb
CHANGED
@@ -5,13 +5,14 @@ require 'logger'
|
|
5
5
|
require 'active_record'
|
6
6
|
require_relative '../lib/tanga_que_extensions'
|
7
7
|
|
8
|
-
ActiveRecord::Base.establish_connection 'postgres://localhost/
|
8
|
+
ActiveRecord::Base.establish_connection 'postgres://localhost/channel_advisor_dev'
|
9
9
|
Que.connection = ActiveRecord
|
10
10
|
|
11
|
-
|
11
|
+
QueJob.delete_all
|
12
|
+
QueJobStatus.delete_all
|
12
13
|
|
13
|
-
#
|
14
|
-
#
|
14
|
+
# ActiveRecord::Base.logger = Logger.new($stdout)
|
15
|
+
# Que.logger = Logger.new(STDOUT)
|
15
16
|
|
16
17
|
class J < Que::Job
|
17
18
|
prepend Que::RecordJobStatus
|
@@ -39,17 +40,18 @@ class J < Que::Job
|
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
42
|
-
|
43
|
-
|
43
|
+
|
44
|
+
# Running job manually and getting status
|
45
|
+
job_id = J.enqueue({foo: 4, joe: 'args'}).attrs['job_id']
|
46
|
+
QueJob.find(job_id).run
|
47
|
+
puts QueJobStatus.raw_job_data(job_id)
|
48
|
+
|
49
|
+
Que.mode = :async
|
44
50
|
|
45
51
|
loop do
|
46
52
|
J.enqueue({foo: 1, joe: 'args'})
|
47
53
|
J.enqueue({foo: 1, joe: 'args'})
|
48
|
-
|
49
|
-
#J.enqueue({foo: 1, joe: 'args'})
|
50
|
-
#J.enqueue({foo: 1, joe: 'args'})
|
51
|
-
#J.enqueue({foo: 1, joe: 'args'})
|
54
|
+
|
52
55
|
sleep 1
|
53
56
|
end
|
54
57
|
|
55
|
-
gets
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tanga_que_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Van Dyk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: que
|