diff options
author | Eric Wong <e@80x24.org> | 2016-11-26 08:06:50 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-11-26 08:06:50 +0000 |
commit | 5e65897053f20fc6d09ab22448c43d7103c779f2 (patch) | |
tree | 05d5d5467c6255364b9a8cdebfa2dccd1f417516 /lib/dtas/mlib.rb | |
parent | af91a075c10cfc7dd6f7e04c55ae2b14dc25d1ea (diff) | |
download | dtas-5e65897053f20fc6d09ab22448c43d7103c779f2.tar.gz |
This ought to avoid busy DB errors.
Diffstat (limited to 'lib/dtas/mlib.rb')
-rw-r--r-- | lib/dtas/mlib.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/dtas/mlib.rb b/lib/dtas/mlib.rb index 09856ee..a01a136 100644 --- a/lib/dtas/mlib.rb +++ b/lib/dtas/mlib.rb @@ -298,8 +298,10 @@ class DTAS::Mlib # :nodoc: dir = dir_vivify(@pwd.split(%r{/+}n), st.ctime.to_i) dir_id = dir[:id] - @db[:nodes].where(parent_id: dir_id).each do |node| - File.exist?(node[:name]) or remove_entry(node) + @db.transaction do + @db[:nodes].where(parent_id: dir_id).each do |node| + File.exist?(node[:name]) or remove_entry(node) + end end Dir.foreach('.', encoding: Encoding::BINARY) do |x| |