magellan-gcs-proxy 0.1.2 → 0.1.3

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: 1232e616e80b9b1c977f0ac7f082d093a3502799
4
- data.tar.gz: 8b23997772e69ac5685fc5f65b7526953ea343e2
3
+ metadata.gz: f274888037621b3123477b9770fe6a47aad3261f
4
+ data.tar.gz: a63901a3c16ee906bdfaabbef597abedfc959c36
5
5
  SHA512:
6
- metadata.gz: 3e48f5f6203aac1ac89968c708bed4028390b49ad97666dd70654059bf9d55125bed1cdaa08a24a8ffd1afdbf1b4b1f34d48fa7d0973d1d9e2ff05b2e94574c2
7
- data.tar.gz: 4d915466137763f3c37c59d2c3621c054b064ea3f2f9ef0cf8327f8a70a9a028b2ad9ce00dce8b3a4cd8bb3411cdc102ba316d1a87599e6066f44c6ed506ad58
6
+ metadata.gz: 5e9f4f0c29a3aa5537e717693daf8c5ec65ae9a228454a79c14e98cbbd0d0e6371388ecfa325b18215ec3f652fb46d4b597fa8fb8e37baf5b8aeb598409d3f4f
7
+ data.tar.gz: c640f5d0e52f2a8c27b96a8e4a72f707ee37561df9a956a75087098fc926d6704e7fc960de24a7cc0ce7335d97a966c8db6e52e00b4f8a461426db4cf6670e98
data/example/Gemfile.lock CHANGED
@@ -26,7 +26,7 @@ GEM
26
26
  retriable (~> 2.0)
27
27
  google-cloud-core (0.21.1)
28
28
  googleauth (~> 0.5.1)
29
- google-cloud-logging (0.21.1)
29
+ google-cloud-logging (0.23.0)
30
30
  google-cloud-core (~> 0.21.0)
31
31
  google-gax (~> 0.6.0)
32
32
  google-protobuf (~> 3.0)
@@ -40,7 +40,7 @@ GEM
40
40
  googleapis-common-protos (~> 1.3)
41
41
  grpc (~> 1.0)
42
42
  grpc-google-iam-v1 (~> 0.6.8)
43
- google-cloud-storage (0.21.0)
43
+ google-cloud-storage (0.23.1)
44
44
  digest-crc (~> 0.4)
45
45
  google-api-client (~> 0.9.11)
46
46
  google-cloud-core (~> 0.21.0)
@@ -68,7 +68,7 @@ GEM
68
68
  googleapis-common-protos (~> 1.3.1)
69
69
  googleauth (~> 0.5.1)
70
70
  grpc (~> 1.0)
71
- httpclient (2.8.2.4)
71
+ httpclient (2.8.3)
72
72
  hurley (0.2)
73
73
  jwt (1.5.6)
74
74
  little-plugger (1.1.4)
@@ -76,7 +76,7 @@ GEM
76
76
  logging (2.1.0)
77
77
  little-plugger (~> 1.1)
78
78
  multi_json (~> 1.10)
79
- magellan-gcs-proxy (0.1.1)
79
+ magellan-gcs-proxy (0.1.3)
80
80
  dotenv
81
81
  google-cloud-logging
82
82
  google-cloud-pubsub
@@ -95,7 +95,7 @@ GEM
95
95
  coderay (~> 1.1.0)
96
96
  method_source (~> 0.8.1)
97
97
  slop (~> 3.4)
98
- pry-byebug (3.4.1)
98
+ pry-byebug (3.4.2)
99
99
  byebug (~> 9.0)
100
100
  pry (~> 0.10)
101
101
  pry-stack_explorer (0.4.9.2)
@@ -18,6 +18,7 @@ module Magellan
18
18
  end
19
19
 
20
20
  def run
21
+ logger.info("#{$PROGRAM_NAME}-#{VERSION} is running")
21
22
  logger.info('Start listening')
22
23
  GCP.subscription.listen do |msg|
23
24
  process_with_error_handling(msg)
@@ -38,15 +38,31 @@ module Magellan
38
38
 
39
39
  def run
40
40
  loop do
41
- sleep(interval)
42
- break unless Thread.current[:processing_message]
43
- begin
44
- message.delay! delay
45
- rescue => e
46
- logger.error(e)
41
+ debug("is sleeping #{interval} sec.")
42
+ unless wait_while_processing(interval)
43
+ debug('is stopping.')
47
44
  break
48
45
  end
46
+ debug("is sending delay!(#{delay})")
47
+ message.delay! delay
48
+ debug("sent delay!(#{delay}) successfully")
49
49
  end
50
+ debug('stopped.')
51
+ rescue => e
52
+ logger.error(e)
53
+ end
54
+
55
+ def debug(msg)
56
+ logger.debug("#{self.class.name} #{msg}")
57
+ end
58
+
59
+ def wait_while_processing(seconds)
60
+ limit = Time.now.to_f + seconds
61
+ while Time.now.to_f < limit
62
+ return false unless Thread.current[:processing_message]
63
+ sleep(0.1)
64
+ end
65
+ true
50
66
  end
51
67
  end
52
68
  end
@@ -1,7 +1,7 @@
1
1
  module Magellan
2
2
  module Gcs
3
3
  module Proxy
4
- VERSION = '0.1.2'.freeze
4
+ VERSION = '0.1.3'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magellan-gcs-proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - akm
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-13 00:00:00.000000000 Z
11
+ date: 2016-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv