rbbt-util 5.5.8 → 5.5.9
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 +8 -8
- data/lib/rbbt/persist.rb +20 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzZjOWMzZjRhNWIyMmRhMjc1MjM1NGU3NGNhNWJiMWU3MmE4ZDExYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzhlY2RmNWYxNDk4ZTNmMTk2ZTU3NTYyN2JhNmY4YmJiMzUxYzQ3MA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDBmM2RhZWI3MTc3Nzc5OGQ5NGIxN2I0ZTg4ZDkyNmRlMmY5MzhjODU1YzU3
|
10
|
+
NWM4MjlmZmM5NGZiMjEzNjUyZWE0NjJkMDQ1NTEzNjJjNjVmMTcxOThiMTY5
|
11
|
+
YTQ0ZDNmYzJhOTQ3MzJmYWRkNDIwMDYxMmE4ZDZlN2ZlMTYyMzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2QzYWEyNDAxYWRmOGIyMDM5YmU1YTAxZDQ3ZDA5Mzg5Njk4OTY1Zjc4Y2U4
|
14
|
+
ZDAwZjFiOWVlYzg1NzNkNDk2NzEzNzdkMjVjN2U2ZTk4MjQzMzY0MzRjMmY0
|
15
|
+
YzhkYmJiZDE3OGE0NmI0NTU4NjVmYzNhN2YwYzZmZDhkZDc4Y2E=
|
data/lib/rbbt/persist.rb
CHANGED
@@ -14,6 +14,12 @@ module Persist
|
|
14
14
|
def self.cachedir
|
15
15
|
@cachedir ||= Rbbt.var.cache.persistence
|
16
16
|
end
|
17
|
+
|
18
|
+
attr_accessor :lock_dir
|
19
|
+
|
20
|
+
def lock_dir
|
21
|
+
@lock_dir ||= Rbbt.tmp.tsv_open_locks.find
|
22
|
+
end
|
17
23
|
end
|
18
24
|
|
19
25
|
MEMORY = {} unless defined? MEMORY
|
@@ -256,16 +262,24 @@ module Persist
|
|
256
262
|
Log.low "Persist up-to-date: #{ path } - #{persist_options.inspect[0..100]}"
|
257
263
|
return nil if persist_options[:no_load]
|
258
264
|
return load_file(path, type)
|
259
|
-
else
|
260
|
-
Log.medium "Persist create: #{ path } - #{persist_options.inspect[0..100]}"
|
261
265
|
end
|
262
266
|
|
263
267
|
begin
|
264
|
-
|
265
|
-
Misc.lock
|
266
|
-
|
268
|
+
lock_filename = Persist.persistence_path(path + '.persist', {:dir => Persist.lock_dir})
|
269
|
+
Misc.lock lock_filename do
|
270
|
+
if is_persisted?(path, persist_options)
|
271
|
+
Log.low "Persist up-to-date: #{ path } - #{persist_options.inspect[0..100]}"
|
272
|
+
return nil if persist_options[:no_load]
|
273
|
+
return load_file(path, type)
|
274
|
+
end
|
275
|
+
|
276
|
+
Log.medium "Persist create: #{ path } - #{persist_options.inspect[0..100]}"
|
277
|
+
res = yield
|
278
|
+
Misc.lock(path) do
|
279
|
+
save_file(path, type, res)
|
280
|
+
end
|
281
|
+
res
|
267
282
|
end
|
268
|
-
res
|
269
283
|
rescue
|
270
284
|
Log.high "Error in persist. #{Open.exists?(path) ? "Erasing '#{ path }'" : ""}"
|
271
285
|
FileUtils.rm path if Open.exists? path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.5.
|
4
|
+
version: 5.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|