lib/factbase/looged.rb in factbase-0.0.49 vs lib/factbase/looged.rb in factbase-0.0.50
- old
+ new
@@ -52,20 +52,25 @@
def query(query)
Query.new(@fb, query, @loog)
end
def txn(this = self, &)
+ start = Time.now
before = @fb.size
- tail = nil
+ id = nil
+ rollback = false
r = @fb.txn(this) do |fbt|
- tail = Factbase::Looged.elapsed do
- yield fbt
- end
+ id = fbt.object_id
+ yield fbt
rescue Factbase::Rollback => e
- @loog.debug('Txn rolled back')
+ rollback = true
raise e
end
- @loog.debug("Txn #{r ? 'modified' : 'didn\'t touch'} #{before} facts #{tail}")
+ if rollback
+ @loog.debug("Txn ##{id} rolled back in #{start.ago}")
+ else
+ @loog.debug("Txn ##{id} #{r ? 'modified' : 'didn\'t touch'} #{before} facts in #{start.ago}")
+ end
r
end
def export
@fb.export