umlaut 3.0.0beta6 → 3.0.0beta7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/service_adaptors/hathi_trust.rb +7 -0
- data/lib/tasks/Untitled-1 +8 -0
- data/lib/umlaut.rb +8 -0
- data/lib/umlaut/version.rb +1 -1
- metadata +112 -36
- data/config/initializers/extensions/connection_pool.rb +0 -97
@@ -125,9 +125,16 @@ class HathiTrust < Service
|
|
125
125
|
# the parameters for the particular service
|
126
126
|
# FIXME consider moving this into metadata_helper
|
127
127
|
def get_bibkey_parameters(rft)
|
128
|
+
# filter out special chars that ought not to be in there anyway,
|
129
|
+
# and that HathiTrust barfs on.
|
128
130
|
isbn = get_identifier(:urn, "isbn", rft)
|
131
|
+
isbn = isbn.gsub(/[\-\[\]]/, '') unless isbn.blank?
|
132
|
+
|
129
133
|
oclcnum = get_identifier(:info, "oclcnum", rft)
|
134
|
+
oclcnum = oclnum.gsub(/[\-\[\]]/, '') unless oclcnum.blank?
|
135
|
+
|
130
136
|
lccn = get_lccn(rft)
|
137
|
+
lccn = lccn.gsub(/[\-\[\]]/, '') unless lccn.blank?
|
131
138
|
|
132
139
|
yield(isbn, lccn, oclcnum)
|
133
140
|
end
|
data/lib/umlaut.rb
CHANGED
@@ -36,6 +36,14 @@ module Umlaut
|
|
36
36
|
app.config.assets.precompile << "umlaut_ui.js"
|
37
37
|
end
|
38
38
|
|
39
|
+
# Patch with fixed 'fair' version of ConnectionPool, see
|
40
|
+
# active_record_patch/connection_pool.rb
|
41
|
+
initializer("#{engine_name}.patch_connection_pool", :before => "active_record.initialize_database") do |app|
|
42
|
+
load File.join(self.root, "active_record_patch", "connection_pool.rb")
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
|
39
47
|
|
40
48
|
end
|
41
49
|
end
|
data/lib/umlaut/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: umlaut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.0beta7
|
5
5
|
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.
|
21
|
+
version: 3.2.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.3
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: jquery-rails
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,21 +37,31 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: nokogiri
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
|
-
- - =
|
51
|
+
- - '='
|
42
52
|
- !ruby/object:Gem::Version
|
43
53
|
version: 1.5.0
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.5.0
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: openurl
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,21 +69,37 @@ dependencies:
|
|
54
69
|
version: 0.3.0
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.3.0
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: marc
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
|
-
- -
|
83
|
+
- - ! '>='
|
64
84
|
- !ruby/object:Gem::Version
|
65
85
|
version: 0.4.3
|
86
|
+
- - <
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.1'
|
66
89
|
type: :runtime
|
67
90
|
prerelease: false
|
68
|
-
version_requirements:
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.4.3
|
97
|
+
- - <
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '1.1'
|
69
100
|
- !ruby/object:Gem::Dependency
|
70
101
|
name: isbn
|
71
|
-
requirement:
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
72
103
|
none: false
|
73
104
|
requirements:
|
74
105
|
- - ! '>='
|
@@ -76,10 +107,15 @@ dependencies:
|
|
76
107
|
version: '0'
|
77
108
|
type: :runtime
|
78
109
|
prerelease: false
|
79
|
-
version_requirements:
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
80
116
|
- !ruby/object:Gem::Dependency
|
81
117
|
name: htmlentities
|
82
|
-
requirement:
|
118
|
+
requirement: !ruby/object:Gem::Requirement
|
83
119
|
none: false
|
84
120
|
requirements:
|
85
121
|
- - ! '>='
|
@@ -87,10 +123,15 @@ dependencies:
|
|
87
123
|
version: '0'
|
88
124
|
type: :runtime
|
89
125
|
prerelease: false
|
90
|
-
version_requirements:
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
91
132
|
- !ruby/object:Gem::Dependency
|
92
133
|
name: multi_json
|
93
|
-
requirement:
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
94
135
|
none: false
|
95
136
|
requirements:
|
96
137
|
- - ! '>='
|
@@ -98,10 +139,15 @@ dependencies:
|
|
98
139
|
version: '0'
|
99
140
|
type: :runtime
|
100
141
|
prerelease: false
|
101
|
-
version_requirements:
|
142
|
+
version_requirements: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - ! '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
102
148
|
- !ruby/object:Gem::Dependency
|
103
149
|
name: confstruct
|
104
|
-
requirement:
|
150
|
+
requirement: !ruby/object:Gem::Requirement
|
105
151
|
none: false
|
106
152
|
requirements:
|
107
153
|
- - ~>
|
@@ -109,10 +155,15 @@ dependencies:
|
|
109
155
|
version: '0.2'
|
110
156
|
type: :runtime
|
111
157
|
prerelease: false
|
112
|
-
version_requirements:
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
160
|
+
requirements:
|
161
|
+
- - ~>
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0.2'
|
113
164
|
- !ruby/object:Gem::Dependency
|
114
165
|
name: exlibris-primo
|
115
|
-
requirement:
|
166
|
+
requirement: !ruby/object:Gem::Requirement
|
116
167
|
none: false
|
117
168
|
requirements:
|
118
169
|
- - ~>
|
@@ -120,10 +171,15 @@ dependencies:
|
|
120
171
|
version: 0.1.0
|
121
172
|
type: :runtime
|
122
173
|
prerelease: false
|
123
|
-
version_requirements:
|
174
|
+
version_requirements: !ruby/object:Gem::Requirement
|
175
|
+
none: false
|
176
|
+
requirements:
|
177
|
+
- - ~>
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: 0.1.0
|
124
180
|
- !ruby/object:Gem::Dependency
|
125
181
|
name: single_test
|
126
|
-
requirement:
|
182
|
+
requirement: !ruby/object:Gem::Requirement
|
127
183
|
none: false
|
128
184
|
requirements:
|
129
185
|
- - ~>
|
@@ -131,10 +187,15 @@ dependencies:
|
|
131
187
|
version: 0.5.1
|
132
188
|
type: :development
|
133
189
|
prerelease: false
|
134
|
-
version_requirements:
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
none: false
|
192
|
+
requirements:
|
193
|
+
- - ~>
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: 0.5.1
|
135
196
|
- !ruby/object:Gem::Dependency
|
136
197
|
name: uglifier
|
137
|
-
requirement:
|
198
|
+
requirement: !ruby/object:Gem::Requirement
|
138
199
|
none: false
|
139
200
|
requirements:
|
140
201
|
- - ! '>='
|
@@ -142,10 +203,15 @@ dependencies:
|
|
142
203
|
version: '0'
|
143
204
|
type: :development
|
144
205
|
prerelease: false
|
145
|
-
version_requirements:
|
206
|
+
version_requirements: !ruby/object:Gem::Requirement
|
207
|
+
none: false
|
208
|
+
requirements:
|
209
|
+
- - ! '>='
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: '0'
|
146
212
|
- !ruby/object:Gem::Dependency
|
147
213
|
name: therubyracer
|
148
|
-
requirement:
|
214
|
+
requirement: !ruby/object:Gem::Requirement
|
149
215
|
none: false
|
150
216
|
requirements:
|
151
217
|
- - ! '>='
|
@@ -153,10 +219,15 @@ dependencies:
|
|
153
219
|
version: '0'
|
154
220
|
type: :development
|
155
221
|
prerelease: false
|
156
|
-
version_requirements:
|
222
|
+
version_requirements: !ruby/object:Gem::Requirement
|
223
|
+
none: false
|
224
|
+
requirements:
|
225
|
+
- - ! '>='
|
226
|
+
- !ruby/object:Gem::Version
|
227
|
+
version: '0'
|
157
228
|
- !ruby/object:Gem::Dependency
|
158
229
|
name: ruby-prof
|
159
|
-
requirement:
|
230
|
+
requirement: !ruby/object:Gem::Requirement
|
160
231
|
none: false
|
161
232
|
requirements:
|
162
233
|
- - ! '>='
|
@@ -164,7 +235,12 @@ dependencies:
|
|
164
235
|
version: '0'
|
165
236
|
type: :development
|
166
237
|
prerelease: false
|
167
|
-
version_requirements:
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
none: false
|
240
|
+
requirements:
|
241
|
+
- - ! '>='
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0'
|
168
244
|
description:
|
169
245
|
email:
|
170
246
|
- umlaut-general@rubyforge.org
|
@@ -300,7 +376,6 @@ files:
|
|
300
376
|
- app/helpers/open_search_helper.rb
|
301
377
|
- app/helpers/resolve_helper.rb
|
302
378
|
- app/helpers/search_helper.rb
|
303
|
-
- config/initializers/extensions/connection_pool.rb
|
304
379
|
- db/seeds.rb
|
305
380
|
- db/migrate/01_umlaut_init.rb
|
306
381
|
- db/orig_fixed_data/service_type_values.yml
|
@@ -369,6 +444,7 @@ files:
|
|
369
444
|
- lib/aws_product_sign.rb
|
370
445
|
- lib/tasks/umlaut_migrate_permalinks.rake
|
371
446
|
- lib/tasks/umlaut.rake
|
447
|
+
- lib/tasks/Untitled-1
|
372
448
|
- LICENSE
|
373
449
|
- Rakefile
|
374
450
|
- README.md
|
@@ -481,7 +557,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
481
557
|
version: '0'
|
482
558
|
segments:
|
483
559
|
- 0
|
484
|
-
hash:
|
560
|
+
hash: -1531856936954228616
|
485
561
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
486
562
|
none: false
|
487
563
|
requirements:
|
@@ -490,7 +566,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
490
566
|
version: 1.3.1
|
491
567
|
requirements: []
|
492
568
|
rubyforge_project:
|
493
|
-
rubygems_version: 1.8.
|
569
|
+
rubygems_version: 1.8.24
|
494
570
|
signing_key:
|
495
571
|
specification_version: 3
|
496
572
|
summary: For Libraries, a just-in-time last-mile service aggregator, taking OpenURL
|
@@ -1,97 +0,0 @@
|
|
1
|
-
# NOTE: THIS NEEDS TO BE REMOVED WHEN RAILS IS FIXED!
|
2
|
-
# We expect it will be fixed in rails 3.2.3 (and broken again in 4, sorry)
|
3
|
-
# We require at least 3.2.2, so patch only if we're 3.2.2
|
4
|
-
|
5
|
-
if Rails.version == "3.2.2"
|
6
|
-
|
7
|
-
|
8
|
-
class ActiveRecord::ConnectionAdapters::ConnectionPool
|
9
|
-
|
10
|
-
##########################
|
11
|
-
# Monkey patch to fix disastrous concurrency bug in
|
12
|
-
# ActiveRecord ConnectionPool#with_concurrency
|
13
|
-
#
|
14
|
-
# See https://github.com/rails/rails/issues/5330
|
15
|
-
##########################
|
16
|
-
|
17
|
-
# New method we're adding viz a viz rails 3.2.2
|
18
|
-
# Check to see if there is an active connection for
|
19
|
-
# current_connection_id, that is by default the current
|
20
|
-
# thread.
|
21
|
-
def current_connection?
|
22
|
-
@reserved_connections.has_key?(current_connection_id)
|
23
|
-
end
|
24
|
-
|
25
|
-
# Redefine with_connection viz a viz rails 3.2.2 to
|
26
|
-
# properly check back in connections.
|
27
|
-
# If a connection already exists yield it to the block. If no connection
|
28
|
-
# exists checkout a connection, yield it to the block, and checkin the
|
29
|
-
# connection when finished.
|
30
|
-
def with_connection
|
31
|
-
connection_id = current_connection_id
|
32
|
-
fresh_connection = true unless current_connection?
|
33
|
-
yield connection
|
34
|
-
ensure
|
35
|
-
release_connection(connection_id) if fresh_connection
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
###################################
|
40
|
-
#
|
41
|
-
# Monkey patch to fix bug with threads waiting
|
42
|
-
# on connection waking up, not succesfuly getting
|
43
|
-
# a connection, and giving up too early.
|
44
|
-
#
|
45
|
-
# https://github.com/rails/rails/pull/5422
|
46
|
-
#
|
47
|
-
# yeah, we got to replace all of #checkout.
|
48
|
-
# that's why we only apply this patch in 3.2.2, not
|
49
|
-
# in future rails versions.
|
50
|
-
#####################################
|
51
|
-
def checkout
|
52
|
-
synchronize do
|
53
|
-
waited_time = 0
|
54
|
-
|
55
|
-
loop do
|
56
|
-
conn = @connections.find { |c| c.lease }
|
57
|
-
|
58
|
-
unless conn
|
59
|
-
if @connections.size < @size
|
60
|
-
conn = checkout_new_connection
|
61
|
-
conn.lease
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
if conn
|
66
|
-
checkout_and_verify conn
|
67
|
-
return conn
|
68
|
-
end
|
69
|
-
|
70
|
-
if waited_time >= @timeout
|
71
|
-
raise ConnectionTimeoutError, "could not obtain a database connection#{" within #{@timeout} seconds" if @timeout} (waited #{waited_time} seconds). The max pool size is currently #{@size}; consider increasing it."
|
72
|
-
end
|
73
|
-
|
74
|
-
# Sometimes our wait can end because a connection is available,
|
75
|
-
# but another thread can snatch it up first. If timeout hasn't
|
76
|
-
# passed but no connection is avail, looks like that happened --
|
77
|
-
# loop and wait again, for the time remaining on our timeout.
|
78
|
-
before_wait = Time.now
|
79
|
-
@queue.wait( [@timeout - waited_time, 0].max )
|
80
|
-
waited_time += (Time.now - before_wait)
|
81
|
-
|
82
|
-
# Will go away in Rails 4, when we don't clean up
|
83
|
-
# after leaked connections automatically anymore. Right now, clean
|
84
|
-
# up after we've returned from a 'wait' if it looks like it's
|
85
|
-
# needed, then loop and try again.
|
86
|
-
if(active_connections.size >= @connections.size)
|
87
|
-
clear_stale_cached_connections!
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|