relaton 1.9.4 → 1.9.5

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
  SHA256:
3
- metadata.gz: 250207e6a1eaa872380c5b959d727be909d99874797832a4288a058259e96bb2
4
- data.tar.gz: df287ddd627ff37b9ecbcd3207a4eb8216690b9d3df9db2a9b31ff2a3648a363
3
+ metadata.gz: d130b4485dbbf753e79494a4d586acf8fd85df120d4e2f1f35aa5c7380e05811
4
+ data.tar.gz: 1872fc4d88f29de709f81dfca39132d1c7fb244b9069661d8c7c4bca70a80977
5
5
  SHA512:
6
- metadata.gz: 75eecbdaa0c5d6bc954b790eecba13d987974be787181332343b23558534543fb4107366444fe49aab6fea2e54830dc46051449f482d494a9afad0f3bd502abf
7
- data.tar.gz: 159b1e402d0b8521634598412edb68cf8e468009d24e96be56f678df98a62099b568d8de04c77a10ed72faed770f4d87d536fd1e152fa24f39786540d5e51643
6
+ metadata.gz: 1209e92a74b33acc54fcc1f391ec4beb1833cb2886375188f16ff8feb6c7c12c6f2e56978b3a77b442599fafa5bfbc4b4edfec6305e422afdb97cbc3e07190a0
7
+ data.tar.gz: f5a8c37e80afa5b80d7779735d54f685e9ba85a2bea6acd2ad3a4608b4e74d75c76248b6989af7df05df1f50f975b0ab85397355c90c2c2f50bc00159fc7d5fe
data/lib/relaton/db.rb CHANGED
@@ -17,6 +17,7 @@ module Relaton
17
17
  @static_db = open_cache_biblio File.expand_path("../relaton/static_cache",
18
18
  __dir__)
19
19
  @queues = {}
20
+ @semaphore = Mutex.new
20
21
  end
21
22
 
22
23
  # Move global or local caches to anothe dirs
@@ -375,14 +376,20 @@ module Relaton
375
376
  return bib_retval(bibentry, stdclass)
376
377
  end
377
378
 
378
- db.delete(id) unless db.valid_entry?(id, year)
379
+ @semaphore.synchronize do
380
+ db.delete(id) unless db.valid_entry?(id, year)
381
+ end
379
382
  if altdb
380
383
  return bib_retval(altdb[id], stdclass) if opts[:fetch_db]
381
384
 
382
- db.clone_entry id, altdb if altdb.valid_entry? id, year
383
- db[id] ||= new_bib_entry(searchcode, year, opts, stdclass, db: db,
384
- id: id)
385
- altdb.clone_entry(id, db) if !altdb.valid_entry?(id, year)
385
+ @semaphore.synchronize do
386
+ db.clone_entry id, altdb if altdb.valid_entry? id, year
387
+ end
388
+ entry = new_bib_entry(searchcode, year, opts, stdclass, db: db, id: id) unless db[id]
389
+ @semaphore.synchronize do
390
+ db[id] ||= entry
391
+ altdb.clone_entry(id, db) if !altdb.valid_entry?(id, year)
392
+ end
386
393
  else
387
394
  return bib_retval(db[id], stdclass) if opts[:fetch_db]
388
395
 
@@ -413,7 +420,7 @@ module Relaton
413
420
  if args[:db] && args[:id] &&
414
421
  bib_id && args[:id] !~ %r{#{Regexp.quote("(#{bib_id})")}}
415
422
  bid = std_id(bib.docidentifier.first.id, nil, {}, stdclass).first
416
- args[:db][bid] ||= bib_entry bib
423
+ @semaphore.synchronize { args[:db][bid] ||= bib_entry bib }
417
424
  "redirection #{bid}"
418
425
  else bib_entry bib
419
426
  end
@@ -1,3 +1,3 @@
1
1
  module Relaton
2
- VERSION = "1.9.4".freeze
2
+ VERSION = "1.9.5".freeze
3
3
  end