Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ab911c7

Browse files
Ensure Queue is always callable. Change default log level to error.
1 parent 5192881 commit ab911c7

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

‎CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [0.0.6] - 2021年06月28日
2+
3+
- Ensure Queue is always callable.
4+
- Change default log level to `error`.
5+
16
## [0.0.5] - 2021年06月28日
27

38
- Ensure Queue is always present.

‎Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
lambda_punch (0.0.5)
4+
lambda_punch (0.0.6)
55
concurrent-ruby
66
rake
77
rb-inotify

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ If your application integrates with API Gateway (which has a 30 second timeout)
8484

8585
### Logging
8686

87-
The default log level is `fatal`, so you will not see any LambdaPunch lines in your logs. However, if you want some low level debugging information on how LambdaPunch is working, you can use this environment variable to change the log level.
87+
The default log level is `error`, so you will not see any LambdaPunch lines in your logs. However, if you want some low level debugging information on how LambdaPunch is working, you can use this environment variable to change the log level.
8888

8989
```yaml
9090
Environment:

‎lib/lambda_punch/logger.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def level=(value)
1616
private
1717

1818
def level
19-
l = (@level || ENV['LAMBDA_PUNCH_LOG_LEVEL'] || 'fatal').upcase.to_sym
20-
::Logger.const_defined?(l) ? ::Logger.const_get(l) : ::Logger::FATAL
19+
l = (@level || ENV['LAMBDA_PUNCH_LOG_LEVEL'] || 'error').upcase.to_sym
20+
::Logger.const_defined?(l) ? ::Logger.const_get(l) : ::Logger::ERROR
2121
end
2222

2323
end

‎lib/lambda_punch/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module LambdaPunch
2-
VERSION = "0.0.5"
2+
VERSION = "0.0.6"
33
end

‎lib/lambda_punch/worker.rb

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,25 @@ def call(event_payload)
2626
new(event_payload).call
2727
end
2828

29-
# The `@queue` object is the local process' reference to the application `LambdaPunch::Queue`
30-
# instance which does all the work in the applciation's scope.
29+
# A safe and resilient way to call the remote queue.
3130
#
32-
def queue
33-
@queue
31+
def call_queue
32+
queue.call
3433
rescue DRb::DRbConnError
34+
logger.error "Worker#call_queue => DRb::DRbConnError"
3535
new_drb_queue
36+
queue.call
3637
end
3738

3839
private
3940

41+
# The `@queue` object is the local process' reference to the application `LambdaPunch::Queue`
42+
# instance which does all the work in the applciation's scope.
43+
#
44+
def queue
45+
@queue
46+
end
47+
4048
def new_drb_queue
4149
@queue = DRbObject.new_with_uri(Server.uri)
4250
end
@@ -58,10 +66,10 @@ def initialize(event_payload)
5866
def call
5967
Timeout.timeout(timeout) { @notifier.process }
6068
rescue Timeout::Error
61-
logger.debug "Worker#call => Function timeout reached."
69+
logger.error "Worker#call => Function timeout reached."
6270
ensure
6371
@notifier.close
64-
self.class.queue.call
72+
self.class.call_queue
6573
end
6674

6775
private

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /