activejob_disque_adapter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 305004ad44985be958b7f20d71fc83652333252e
4
+ data.tar.gz: b5a82ec9b026e57426967bca8227d1012b2578d1
5
+ SHA512:
6
+ metadata.gz: ba2d3f3cf0326071dc8e4a7ae30dd667390ddc6867b2759491309d81cc594aae87c6a50b8978449d0e82ecd4a12a25f3890bca6692375e9ecd59cfa2c2c35057
7
+ data.tar.gz: 95e7c730c8db4ded1f3065c561756c75549133aa9fa7b5ca41f333890cdd28a0b2ea3cd832639a34c0748e090144d531c0d30be6f83d120c1e9ceb8e30fa15f1
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ nodes.conf
2
+ .DS_Store
3
+ .gs/
4
+ *.gem
@@ -0,0 +1,15 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "activejob_disque_adapter"
3
+ s.version = "0.0.1"
4
+ s.summary = "ActiveJob adapter for Disque backends"
5
+ s.description = "Fills the gap between ActiveJob and Disque"
6
+ s.authors = ["pote"]
7
+ s.email = ["pote@tardis.com.uy"]
8
+ s.homepage = "https://github.com/pote/activejob_disque_adapter"
9
+ s.license = "MIT"
10
+
11
+ s.files = `git ls-files`.split("\n")
12
+
13
+ s.add_dependency "disque"
14
+ s.add_development_dependency "cutest"
15
+ end
@@ -0,0 +1,34 @@
1
+ require 'disque'
2
+
3
+ module ActiveJob
4
+ module QueueAdapters
5
+ class DisqueAdapter
6
+ def self.enqueue(job)
7
+ client.push(
8
+ job.queue_name,
9
+ job.serialize,
10
+ @disque_timeout
11
+ )
12
+ end
13
+
14
+ def self.enqueue_at(job, timestamp)
15
+ client.push(
16
+ job.queue_name,
17
+ job.serialize,
18
+ @disque_timeout,
19
+ delay: timestamp.to_i - Time.now.to_i
20
+ )
21
+ end
22
+
23
+ def self.client(client: nil, timeout: nil)
24
+ @disque_timeout ||= timeout || ENV.fetch('DISQUE_TIMEOUT', '100').to_i
25
+
26
+ @disque_client ||= client || Disque.new(
27
+ ENV.fetch('DISQUE_NODES'),
28
+ auth: ENV.fetch('DISQUE_AUTH', nil),
29
+ cycle: ENV.fetch('DISQUE_CYCLE', '20000').to_i
30
+ )
31
+ end
32
+ end
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activejob_disque_adapter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - pote
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: disque
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cutest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Fills the gap between ActiveJob and Disque
42
+ email:
43
+ - pote@tardis.com.uy
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - activejob_disque_adapter.gemspec
50
+ - lib/active_job/queue_adapters/disque_adapter.rb
51
+ homepage: https://github.com/pote/activejob_disque_adapter
52
+ licenses:
53
+ - MIT
54
+ metadata: {}
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubyforge_project:
71
+ rubygems_version: 2.4.5
72
+ signing_key:
73
+ specification_version: 4
74
+ summary: ActiveJob adapter for Disque backends
75
+ test_files: []