barbeque 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97319e09ca3ea34d2026ad845e4ba1d0552939fd
|
4
|
+
data.tar.gz: d97fe80c057637486eb31506976a17eba29a1532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e43368a6ae848bc2a38256f34789d6b8d04a52fcf1c3cea76f2fe5a785171076065aff168d096edce2fc80cf12af8aaa205d24bdbd5b65613772b06f392fd57e
|
7
|
+
data.tar.gz: e663effa9d01a89915e99bc4002f54722d27bc6bce5677228ca732360b78d12b75d8cbe152e2261d5b53bad80c84ffcdc5934f3d143bfb4eeff87554150ceb64
|
@@ -13,4 +13,27 @@ class Barbeque::JobQueue < Barbeque::ApplicationRecord
|
|
13
13
|
def sqs_queue_name
|
14
14
|
SQS_NAME_PREFIX + name
|
15
15
|
end
|
16
|
+
|
17
|
+
# Returns queue URL of given name.
|
18
|
+
# Basically, we should use stored queue URL as the documentation[1] suggests.
|
19
|
+
# But when the Barbeque's database is temporarily unavailable due to
|
20
|
+
# scheduled maintenance, we have to build queue URL without the database. The
|
21
|
+
# maintenance mode is enabled by BARBEQUE_DATABASE_MAINTENANCE and
|
22
|
+
# AWS_ACCOUNT_ID variable.
|
23
|
+
# [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-queue-message-identifiers.html#sqs-general-identifiers
|
24
|
+
#
|
25
|
+
# @param name [String] queue name in Barbeque
|
26
|
+
# @return [String] queue URL of SQS
|
27
|
+
def self.queue_url_from_name(name)
|
28
|
+
if database_maintenance_mode?
|
29
|
+
"https://sqs.#{ENV.fetch('AWS_REGION')}.amazonaws.com/#{ENV.fetch('AWS_ACCOUNT_ID')}/#{SQS_NAME_PREFIX}#{name}"
|
30
|
+
else
|
31
|
+
select(:queue_url).find_by!(name: name).queue_url
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.database_maintenance_mode?
|
36
|
+
ENV['BARBEQUE_DATABASE_MAINTENANCE'] == '1' && ENV['AWS_REGION'].present? && ENV['AWS_ACCOUNT_ID'].present?
|
37
|
+
end
|
38
|
+
private_class_method :database_maintenance_mode?
|
16
39
|
end
|
@@ -20,9 +20,9 @@ class Barbeque::MessageEnqueuingService
|
|
20
20
|
|
21
21
|
# @return [String] message_id
|
22
22
|
def run
|
23
|
-
|
23
|
+
queue_url = Barbeque::JobQueue.queue_url_from_name(@queue)
|
24
24
|
response = Barbeque::MessageEnqueuingService.sqs_client.send_message(
|
25
|
-
queue_url:
|
25
|
+
queue_url: queue_url,
|
26
26
|
message_body: build_message.to_json,
|
27
27
|
)
|
28
28
|
response.message_id
|
data/lib/barbeque/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barbeque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: adminlte2-rails
|