I have this in a script that uses works with a database and generates workers which will later also work on this database.
# Connect to a sqlite database.
DB = Sequel.connect('http://ift.tt/1wGB7N8')
# Setup a model for easy modification later.
class Things < Sequel::Model[:a_table]
end
And that works fine when using Things
in this script file, but I can't seem to have this work with sidekiq workers since I keep getting No dataset associated with Sequel::Model
when starting up sidekiq.
I have tried adding require_relative ".../script.rb"
to my worker but I still get the error, same story when adding the above class.
So, basically, how can I have my sidekiq workers write to my database using Sinatra? I can see that in Rails based projects that use ActiveRecord you can just use the new class no problem in Sidekiq workers, but I assume that is some serious rails magic going on behind the scenes so I don't know how to replicate that here.
Aucun commentaire:
Enregistrer un commentaire