I'm just getting started with BackgroundRB, but I'm not sure how to do
what I need to do.

I have many chat rooms (Jabber) which are controlled or mediated by a
Rails app. There are periodic elections carried out in these rooms.

Just this would be easy. I could set up a chron job in the configuration
which gets all the chat rooms from Rails and calls chat.do_election on
each (Chat is a model).

However, it is more complicated.  Often there is not enough members to
vote: no quorum. Sometimes the chatters can "recall" a winner with an
early vote. So each chat room is essentially its own story, with its own
chronology.

I know what the election_worker class will look like:

start_all_elections()# for create
trigger_election(chat_name)# tell Rails Model chat to do election with
individual chat
stop_voting(chat_name)# Rails tells election_worker no quorum
start_voting(chat_name)# quorum is reached
skip_to_vote(chat_name)# vote is taken immediately, and clock reset,
when Rails detects a recall

What I DO NOT know is how to deal with these multiple elections. Are
these THREADS inside the election_worker class? If so, how would I set
these up? (I'm new to threads).  Or are they multiple instances of
election_worker? (Where then would I create multiple instances of the
worker, since Rails has no "entry point"?)

Thanks, any help appreciated

Matt
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to