Displaying 20 results from an estimated 200 matches similar to: "Using my models"
2008 Jan 03
1
Memory leak and long process problem
I use backgroundrb for many long tasks in my system, but I''m having issues
with one in particular. Two large tasks for me are importing people and
updating companies.
def import_contacts(args = nil)
thread_pool.defer(args) do |job_id|
begin
job = ImportJob.find(job_id)
job.process_job
rescue => err
logger.error "MscWorker#import_contacts
2007 Dec 23
2
Minor warnings since 296
Since moving to r296, I get warnings (" warning: already initialized
constant...") for many of my class constants. This did not happen before,
and I do not get the same warnings when loading my application normally.
They are only warnings, so everything still runs, but I thought I would
provide the FYI.
--
Dave Dupre
-------------- next part --------------
An HTML attachment was
2008 Jan 22
2
Threadpool and queuing of tasks
I recently switched over to v1.0, and things are rolling along pretty well.
However, one thing that has always been a little confusing to me is knowing
when to use thread_pool. Since most of my bgrb workers are called from my
web app to process rather than being scheduled, I''m using the thread_pool
for every call. Unfortunately, that means that I have to split up workers
by how many
2007 Dec 24
2
backgroundrb script crashing on startup
Everything works fine on my development box (Ubuntu 7.10, Ruby 1.8.6)
but on my server (Fedora Core 6, Ruby 1.8.5) when I run
script/backgroundrb start, the process fails to start.
This is with Rails 2.0.2 frozen in the app, and I have the most recent
version of the plugin (r297). Is Ruby 1.8.6 a requirement for
backgroundrb now? I can''t figure any other reason it would fail...
2008 Jan 03
1
Thread_pool bug?
I have a previous question regarding long tasks and the thread_pool (sorry
for the dup, I didn''t see the first go through). To try and track things
down, I made a change based on a suggestion found in the archives. I moved
my import contacts worker to its own file and set the pool_size to 1.
class ImportContactsWorker < BackgrounDRb::MetaWorker
set_worker_name
2007 Dec 19
6
thread_pooling sleeping
I''m trying to run a single worker that could perform a periodic task
for a given user.
>From a controller, I imagine something like:
def start_job
MiddleMan.ask_work(:worker => :foo_worker, :worker_method => :perform_task,
:data => { :user_id = current_user.id })
end
def check_job
@status = MiddleMan.ask_status(:worker => :foo_worker)[current_user.id]
end
2008 Mar 18
1
Polling is REALLY slow
I''m having some trouble with using brb for polling for work. Basically, what
I want to do is update the state of a record and have brb notice and start a
process. I do not want to call ask_work for each process because there may
be several places where the object''s state is changed, and I only want to
process once. Plus, I can schedule things better this way. My first
thought
2005 Dec 19
4
need some help designing my messaging system
I am trying to create a messaging system for my users but I''m having a
hard time designing my db. This is what i have in mind, but I am not
sure if its the best approach.
user has_one inbox
user has_one outbox
inbox has_many messages
outbox has_many messages
inbox table
user_id
outbox table
user_id
messages table
box_id (refers to either inbox or outbox - how?)
from_id
to_id
2006 Apr 22
7
Proper Database Design For A Newbie
Hi all,
I am starting out learning Ruby on Rails (coming from a PHP background)
and I have a question about proper database design.
Let me give you a quick example of what I want to do:
Database:
CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`login` varchar(40) default NULL,
`email` varchar(100) default NULL,
`crypted_password` varchar(40) default NULL,
`salt`
2008 Feb 01
3
Job Queue
After some initial stumblings, I think I''ve got the hang of
backgroundrb. It''s great! I''d been thinking for many many months how
cool something like this would be!
I''m trying to make a "job queue". That is, a pool of worker threads
monitor a queue. When a job appears, one of the workers grabs it and
executes the task. When complete, the worker
2008 Apr 30
12
Strange memory issue
Like most, I have a test and a production env. Both are CentOS 5, Ruby
1.8.6, Rails 2.0.2, MySQL 5, and Apache. Both were setup using the
same procedure. Except for the hardware (test: Intel, prod: AMD) and
memory (test: 512M, prod: 1G), both systems are essentially the same
right down to the Rails env. Unfortunately, memory usage is very
different for each.
The test system has 2 mongrel
2008 Jan 03
5
Start script not working when run via Rake
Hi there
I''m using the latest release (r300) and ''script/backgroundrb start'' works
perfectly when executed on the server, but when put inside a Rake task, it
doesn''t launch the worker processes.
The Rake task is as follows:
task :start_backgroundrb do
run "cd #{current_path} && ./script/backgroundrb start"
end
When I run this task, the
2007 Oct 18
9
with_scope issue
I have the following code:
class User < ActiveRecord::Base
has_many :requests do
def find_active(options = {})
with_scope :find => { :conditions => ["requests.active = ?",
true] } do
find(:all, options)
end
end
end
end
Executing user.requests.find_active results in the following SQL:
SELECT * FROM requests WHERE (( requests.user_id = 10 ) AND
(
2007 Dec 25
6
error: no marshal_dump is defined for class Thread
I get this error periodically in backgroundrb.log, but only on my
production box (the one running ruby 1.8.5) - my dev box doesn''t get
this error. As far as I can tell, everything is working ok, despite
the error (I don''t really know how to determine if the jobs are
getting threaded successfully, but they are running, that I am sure
of).
Here''s the dump:
no
2006 Mar 11
4
Problem with 16-in-1 card reader
My new PC has an internal 16-in-1 card reader connected via USB 2.0. The
device is the Techsolo TCR-1640
(http://www.techsolo.de/product/cardreader/tcr_1640/index.php).
I boot from a compact flash inserted in it and I can mount and unmount
the same CF once the system has booted and has mounted the root
partition from my graid3 array.
The problem arise when I replace the inserted CF with another
2007 Dec 13
16
"Tricks" for testing after_create callback???
I''ve got a model Message, which needs to send an email using action
mailer after it''s first saved in the database.
I want to pass the model to the mailer which then uses methods on the
message model to render the email.
So the natural way to do this is in an after_create callback on the
Message model.
But I can''t see an easy way to test this. Here''s my spec
2011 Feb 16
1
test emails did not arrive at SMTP server : after dovecot installation
Just set up postfix & it's running on my RHES 4.2 box.
Immediately after postfix is up, I test sending emails from a permitted
domain
(ahhh, on this postfix server's domain firewall, we even have a firewall
rule
which permits Tcp25 from those few sending domains' SMTP servers) using
an email client to sender_id@[IP_address_of_the_postfix_server] & the
/var/log/maillog on
2008 Jan 03
0
Strange problem
I use backgroundrb for many long tasks in my system, but I''m having issues
with one in particular. Two large tasks for me are importing people and
updating companies.
def import_contacts(args = nil)
thread_pool.defer(args) do |job_id|
begin
job = ImportJob.find(job_id)
job.process_job
rescue => err
logger.error "MscWorker#import_contacts
2009 Sep 28
5
Multi-databases support
Hi,
While I was hacking ovirt-server, I have found that it's currently
restricted to Postgres DB. Even if I like postgres for serious work on a
server, I really prefer to hack/dev locally on a Sqlite or MySQL DB.
I have googled on rails in order to find a good answer for the "foreign
key problem" which forces OVirt to stay on pg. I have found a plugin on
this particular
1998 Jun 17
1
WINS problem ? Samba server not found by all workstations
Hi all, I have a small problem here with Samba (version 1.9.18p7, although I
upgraded this morning to p8). The server is a Sun Solaris 2.6. The clients are
all Windows NT (server & workstations). All the workstations are on a subnet,
and the server on another subnet (so broadcast packets are not able to move
from a station to the server), so I configured Samba as a WINS server, and all