moose-inventory 1.0.5 → 1.0.7
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 +4 -4
- data/.gitignore +1 -0
- data/config/dotfiles/gitignore +1 -0
- data/lib/moose_inventory/db/db.rb +24 -23
- data/lib/moose_inventory/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa64e991a9487d623df71257a5c1aaf59edda5b1
|
|
4
|
+
data.tar.gz: 94b5ae699178d9fdba732e31878899bb988fa15b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7d59d86537df3366dba60baff13c0656915bd42d6d17fd2bfe42080363c8aeef6dfba1e36deca4cdbf92fc59160b9f5d4a8afbb9d63f4ac17cd9ada2b2dc6bc3
|
|
7
|
+
data.tar.gz: 22d2c8eb12465e4c51f7aad80669b2173f6e86501739be2310339b4c0633e9d3b4ad90145faa37525b96c02303ecfe3f011af54afc135562b63208818b9ba85d
|
data/.gitignore
CHANGED
data/config/dotfiles/gitignore
CHANGED
|
@@ -73,30 +73,31 @@ module Moose
|
|
|
73
73
|
yield
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
end
|
|
92
|
-
warn('The database appears to be locked by another process. '\
|
|
93
|
-
" This was try #{tries} of 10. "\
|
|
94
|
-
' Retrying after a pause of random duration.')
|
|
95
|
-
sleep rand()
|
|
96
|
-
retry
|
|
97
|
-
else
|
|
98
|
-
raise
|
|
76
|
+
rescue Sequel::DatabaseError => e
|
|
77
|
+
# We want to rescue Sqlite3::BusyException. But, sequel catches that
|
|
78
|
+
# and re-raises it as Sequel::DatabaseError, with a message referencing
|
|
79
|
+
# the original exception class
|
|
80
|
+
|
|
81
|
+
# We look into e, to see whether it is a BusyException. If not,
|
|
82
|
+
# we re-raise immediately.
|
|
83
|
+
raise unless e.message.include?("BusyException")
|
|
84
|
+
|
|
85
|
+
# Looks like a BusyException, so we retry, after a random delay.
|
|
86
|
+
tries += 1
|
|
87
|
+
case tries
|
|
88
|
+
when 1..10
|
|
89
|
+
if Moose::Inventory::Config._confopts[:trace] == true
|
|
90
|
+
STDERR.puts e.message
|
|
99
91
|
end
|
|
92
|
+
sleep rand()
|
|
93
|
+
retry
|
|
94
|
+
else
|
|
95
|
+
warn('The database appears to be locked by another process, and '\
|
|
96
|
+
" did not become free after #{tries} tries. Giving up. ")
|
|
97
|
+
|
|
98
|
+
# TODO: Some useful advice to the user, as to what to do about this error.
|
|
99
|
+
raise
|
|
100
|
+
end
|
|
100
101
|
|
|
101
102
|
rescue @exceptions[:moose] => e
|
|
102
103
|
warn 'An error occurred during a transaction, any changes have been rolled back.'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moose-inventory
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Russell Davies
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-08-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: indentation
|