Fix busted schema definition (string vs text) - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 3bb9ea703f8ffc3f407674cb195a223882996a30
(DIR) parent 33b395e917709cd99527116189398c68144f4f27
(HTM) Author: HD Moore <hd_moore@rapid7.com>
Date: Thu, 27 Dec 2012 00:22:58 -0600
Fix busted schema definition (string vs text)
Diffstat:
M db/schema.rb | 2 +-
M lib/warvox/jobs/base.rb | 26 +++++++-------------------
2 files changed, 8 insertions(+), 20 deletions(-)
---
(DIR) diff --git a/db/schema.rb b/db/schema.rb
@@ -50,7 +50,7 @@ ActiveRecord::Schema.define(:version => 20110801000003) do
t.text "line_type"
t.text "notes"
t.text "signatures"
- t.string "fprint", :limit => nil
+ t.text "fprint"
t.binary "audio"
t.binary "mp3"
t.binary "png_big"
(DIR) diff --git a/lib/warvox/jobs/base.rb b/lib/warvox/jobs/base.rb
@@ -2,45 +2,33 @@ module WarVOX
module Jobs
class Base
attr_accessor :name, :status
-
+
def type
'base'
end
-
+
def stop
@status = 'active'
end
-
+
def start
@status = 'completed'
end
-
+
def db_save(obj)
max_tries = 100
cur_tries = 0
- begin
- obj.save
- rescue ::SQLite3::BusyException => e
- cur_tries += 1
- if(cur_tries > max_tries)
- $stderr.puts "ERROR: Database is still locked after #{cur_tries} attempts"
- raise e
- return
- end
- Kernel.select(nil, nil, nil, rand(10) * 0.25 )
- retry
- end
+ obj.save!
end
-
+
def clear_zombies
begin
# Clear zombies just in case...
while(Process.waitpid(-1, Process::WNOHANG))
- end
+ end
rescue ::Exception
end
end
end
end
end
-