Skip to content

Commit

Permalink
Remove sqlite support
Browse files Browse the repository at this point in the history
  • Loading branch information
nurse committed Dec 1, 2015
1 parent 7dc0bb7 commit 78c91a1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
10 changes: 2 additions & 8 deletions lib/perfectqueue/backend/rdb_compat.rb
Expand Up @@ -37,13 +37,7 @@ def initialize(client, config)
#password = config[:password]
#user = config[:user]

case url.split('//',2)[0].to_s
when /sqlite/i
@db = Sequel.connect(url, :max_connections=>1)
# sqlite always locks tables on BEGIN
@table_lock = nil
@table_unlock = nil
when /mysql/i
if /\Amysql/i =~ url
require 'uri'

uri = URI.parse(url)
Expand Down Expand Up @@ -76,7 +70,7 @@ def initialize(client, config)
@db.run("SELECT RELEASE_LOCK('#{@table}')")
}
else
raise ConfigError, "'sqlite' and 'mysql' are supported"
raise ConfigError, "only 'mysql' is supported"
end

@last_time = Time.now.to_i
Expand Down
1 change: 0 additions & 1 deletion perfectqueue.gemspec
Expand Up @@ -21,6 +21,5 @@ Gem::Specification.new do |gem|
gem.add_development_dependency "rake", "~> 0.9.2"
gem.add_development_dependency "rspec", "~> 3.3.0"
gem.add_development_dependency "simplecov", "~> 0.10.0"
gem.add_development_dependency "sqlite3", "~> 1.3.3"
gem.add_development_dependency "mysql2", "~> 0.3.20"
end
8 changes: 1 addition & 7 deletions spec/rdb_compat_backend_spec.rb
Expand Up @@ -76,7 +76,7 @@
let (:now){ Time.now.to_i }
let (:client){ double('client') }
let (:table){ 'test_queues' }
let (:config){ {url: 'sqlite://spec/test.db', table: table} }
let (:config){ {url: 'mysql://root:@localhost/perfectqueue_test', table: table} }
let (:db) do
d = Backend::RDBCompatBackend.new(client, config)
s = d.db
Expand All @@ -94,13 +94,7 @@
it 'raises error unless table' do
expect{Backend::RDBCompatBackend.new(client, {url: ''})}.to raise_error(ConfigError)
end
it 'supports sqlite' do
config = {url: 'sqlite://localhost', table: table}
expect(Backend::RDBCompatBackend.new(client, config)).to be_an_instance_of(Backend::RDBCompatBackend)
expect(db.instance_variable_get(:@sql)).to include('max_running')
end
it 'supports mysql' do
config = {url: 'mysql://root:@localhost/perfectqueue_test', table: table}
expect(Backend::RDBCompatBackend.new(client, config)).to be_an_instance_of(Backend::RDBCompatBackend)
expect(db.instance_variable_get(:@sql)).to include('max_running')
end
Expand Down

0 comments on commit 78c91a1

Please sign in to comment.