thomas 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. data/lib/thomas.rb +12 -3
  2. metadata +2 -2
@@ -106,10 +106,19 @@ module Adocca
106
106
 
107
107
  def flush_updates
108
108
  if @@updates.size > 200 || (defined?($FLUSH_THOMAS) && $FLUSH_THOMAS)
109
- @model.transaction do
110
- until @@updates.empty?
111
- @@updates.pop.execute
109
+ retries = 0
110
+ begin
111
+ @model.transaction do
112
+ my_updates = @@updates.clone
113
+ until my_updates.empty?
114
+ my_updates.pop.execute
115
+ end
112
116
  end
117
+ rescue ActiveRecord::StatementInvalid => e
118
+ retries += 1
119
+ retry if retries < 3
120
+ ensure
121
+ @@updates.clear
113
122
  end
114
123
  end
115
124
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: thomas
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.3
7
- date: 2006-12-22 00:00:00 +01:00
6
+ version: 0.1.4
7
+ date: 2007-01-30 00:00:00 +01:00
8
8
  summary: Bayes classifier using memcached
9
9
  require_paths:
10
10
  - lib