json_api_resource_connections 1.0.1 → 1.0.2.wat.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7828a930056b3ebc187c8ff874c80526354435a5
4
- data.tar.gz: bbe4524b1966abe095f4413f66e1862368c460be
3
+ metadata.gz: c75de9f8e679107103959306ebde22496267b2d0
4
+ data.tar.gz: 6551081ab72b371a115502f63239a21912ca85a3
5
5
  SHA512:
6
- metadata.gz: 5bd7a04ead9a66bde3647a9a5f9fd688ebfe3e7c4545e6bbdea7391579b2221825f1992a35e48cda7cfd55b7b2b41aa52e952b050f4166e848f2c321aa3fd6d9
7
- data.tar.gz: 728ee110af4d8029fa1f4cd50c28fdfb0b0ef0c1522330b01fe894411a948c3d2424d7d8c99308992626a27dce354e9ba2a004bce90c8e96b405ffef5716ac30
6
+ metadata.gz: c8fdd7a4fe98a4637e009f67e2bea59575d6ac2bf3b1ad0ff59cad9bff4b05916439c4d98b78410ef7763594ac7eb3c6485b752aa41db61ca808692084c2e7cf
7
+ data.tar.gz: 2b43f6568b4a7e25f79f9f63950e8ab09eea483ce78626a62442046f2647397f145c5b74467fc7abd847bf5289232e97bdaaa031a7a833357f663c5d17347e5f
@@ -10,7 +10,9 @@ module JsonApiResource
10
10
  def initialize(options)
11
11
  super options
12
12
  @caching = options.fetch :caching, true
13
- @timeout = Time.now
13
+ # if the machine is fast enough, a call to this connection can circuitbreak
14
+ # ron a call right after init because Time.now is not granular enough
15
+ @timeout = 10.seconds.ago
14
16
  end
15
17
 
16
18
  def report_error( e )
@@ -53,6 +53,28 @@ module JsonApiResourceConnections
53
53
  # now that we know where to connect to, let's do it
54
54
  add_connection JsonApiResource::Connections::CachedCircuitbreakerServerConnection, client: self.client_class
55
55
  end
56
+
57
+ def cacheless_find( id )
58
+ direct_execute :find, id
59
+ end
60
+
61
+ def cacheless_where( opts = {} )
62
+ direct_execute :where, opts
63
+ end
64
+
65
+ private
66
+
67
+ # skips looking in cache first and goes to the server directly
68
+ def direct_execute( action, *args )
69
+ results = cacheless_connection.execute(action, *args)
70
+ JsonApiResource::Handlers::FindHandler.new(results).result
71
+ end
72
+
73
+ def cacheless_connection
74
+ @cacheless_connection ||=_connections.find do |c|
75
+ c.is_a? JsonApiResource::Connections::CachedCircuitbreakerServerConnection
76
+ end
77
+ end
56
78
  end
57
79
  end
58
80
  end
@@ -1,3 +1,3 @@
1
1
  module JsonApiResourceConnections
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2.wat.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_api_resource_connections
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2.wat.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-16 00:00:00.000000000 Z
11
+ date: 2017-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -120,13 +120,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - ">="
123
+ - - ">"
124
124
  - !ruby/object:Gem::Version
125
- version: '0'
125
+ version: 1.3.1
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.4.6
128
+ rubygems_version: 2.5.1
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: circuit breaker and cache fallback connections for json api resource v2
132
132
  test_files: []
133
+ has_rdoc: