ec2-api-proxy 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ module EC2APIProxy
14
14
  @logger.debug("backend: unbind connection")
15
15
  end
16
16
 
17
- unless @data_list.empty?
17
+ if @memcached_key and not @data_list.empty?
18
18
  data = @data_list.join
19
19
  @proxy.memcached.set(@memcached_key, data, @proxy.options[:expires])
20
20
 
@@ -1,2 +1,2 @@
1
1
  APP_NAME = 'ec2-api-proxy'
2
- Version = '0.1.0'
2
+ Version = '0.1.1'
@@ -40,15 +40,19 @@ module EC2APIProxy
40
40
  EM.defer {
41
41
  begin
42
42
  endpoint, params = parse_proxy_request(data)
43
+ action = (params['Action'] || []).first
44
+ allow_cache = !!(/\ADescribe/ =~ action)
43
45
  key = params_to_key(params)
44
46
 
45
- if (cache = @memcached.get(key))
47
+ @logger.debug("proxy: #{action} (allow_cache=#{allow_cache})") if @options[:debug]
48
+
49
+ if (allow_cache and cache = @memcached.get(key))
46
50
  @logger.debug("proxy: cache hit (length=#{cache.length})") if @options[:debug]
47
51
  send_data(cache)
48
52
  close_connection_after_writing
49
53
  else
50
54
  @logger.debug("proxy: cache miss") if @options[:debug]
51
- @backend = EM.connect(endpoint.host, endpoint.port, EC2APIProxy::Backend, self, key)
55
+ @backend = EM.connect(endpoint.host, endpoint.port, EC2APIProxy::Backend, self, (allow_cache ? key : nil))
52
56
 
53
57
  if @backend.error?
54
58
  @logger.error("proxy: backend connection error: #{data.inspect}")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2-api-proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: