Displaying 10 results from an estimated 10 matches for "add_periodic_tim".
Did you mean:
add_periodic_timer
2007 Nov 02
10
pre-release version of backgroundrb available now from svn
...ject is
enough i thought. Also, you may encounter some bugs when you are
passing large objects around.
I will try to explain meat of a sample worker:
class FooWorker < MetaWorker
set_worker_name :foo_worker
attr_accessor :count
def worker_init
puts "Starting Foo Worker"
add_periodic_timer(4) { increment_status}
end
def process_request p_data
p p_data
end
def increment_status
@count ||= 0
@count += 1
register_status(@count)
end
end
First, I intend to wrap MetaWorker within a namespace(read module), so
pardon me there.
So, when backgroundrb starts it rea...
2008 Jan 13
3
right usage of bdrb
Hi,
i''m going to implement a syndication-service, which will get lists in
xml with some meta-data an enclosed video files, which will get encoded
at the end. The syndication run will be startet every five minutes of
a full hour.
So i thought to build 4 Worker. One for checking which feeds to
syndicate (syndication_worker) at a specific time, one for processing
the list
2007 Oct 31
4
How you want BackgrounDrb to behave
...rkers in a worker directory and they
will be picked and run.
Now, It should be noted that, part of stability that comes to new
version is because of total lack of threads. Even timers are
implemented using evented model of programming. Right now, we have two
methods "add_timer" and "add_periodic_timer" available in all the
workers, which can be used to schedule a job.
A sample use case is:
def worker_init
add_periodic_timer(10) { puts "Hello World : #{Time.now}"}
end
Older version of BackgrounDrb was having a seperate file which was
used for reading worker schedules. I am...
2007 Nov 14
7
BackgrounDRb version 1.0RC1 available now
...on of a method should be more than the time thats actually
required to execute the method.
If a method takes longer time than the time window specified, your
method invocations would lag
perpetually.
- Normal Scheduler
You can use second form of scheduling as shown in config file.
- add_periodic_timer method
A third and very basic form of scheduling that you can use is,
"add_periodic_timer" method. You can call
method from anywhere in your worker.
def create
add_periodic_timer(5) { say_hello }
end
Above snippet would register the proc...
2008 May 03
2
backgroundrb / actionmailer / sendmail
Hello,
I''m trying to send emails from a backgroundrb worker and the email doesn''t
send. I get no log messages in the sendmail log or the system log, nothing
in the backgroundrb logs at all, nothing in the production log.
Below is my code for each component
worker:
class QuizReviewerWorker < BackgrounDRb::MetaWorker
set_worker_name :quiz_review_sender
def create(args =
2008 Jan 25
1
worker and sleep
Hi Hermant,
I have seen some earlier messages in the list where you warned people
never to use sleep() in workers. However, currently I have a need for
a worker to issue a command to an external host and then keep
checking that external host for a status change. Other than sleep,
what else can be used to make a worker wait some time (say 1 second)
between checks?
cheers,
mengkuan
2008 Apr 08
0
cron trigger problem
...rent_time)
Not sure what is going on since cron trigger does work correctly few
times before this error occurs. Is it possible for Chronic to be
reloaded? I am running in development mode with chronic (0.2.3).
Has anyone seen something similar? Obviously, I can run my task every
10 secs using the add_periodic_timer, but I was hoping to use
cron-style config.
Thanks,
Paul
2008 Apr 30
5
get_peername - start_server vs. connect
Hi,
On windows, get_peername works both with connections obtained
via start_server, and connections obtained via connect.
On linux, get_peername seems to only work with connections
obtained via start_server.
(I''m using svn HEAD.)
I''m wondering which is the intended behavior?
(I realize get_peername is less useful for connections obtained
via connect, since one should already
2008 Mar 25
0
Questions about backgroundrb
...You can mitigate this easily by adding scheduled tasks to
thread pool as well. What I mean is, say method "scheduled_crawling"
initiates scheduled crawling of pages preferred by all users on
current website. You can schedule "scheduled_crawling" through cron
scheduler or normal add_periodic_timer method. Now, since you do not
want scheduled processing to block rest of the request/response cycle,
you can do:
def scheduled_crawling
x = find_pages_to_crawl
thread_pool.defer {|x| crawl_without_xml_jxon(x)}
end
All in all, its a bit tricky and hence all the best.
2007 Dec 28
9
lost connection 2.0
I lost my "connection lost" error.. but now I''ve got a "Mysql::Error:
MySQL server has gone away" error..
It comes from:
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/connection_adapters/abstract_adapter.rb:128:in ''log''.
I''m not sure if Rails / BackgroundRb uses it .. but i''ve got the mysql
(2.7) gem