Method: ModSpox::PriorityQueue#priority_queue
- Defined in:
- lib/mod_spox/PriorityQueue.rb
#priority_queue(target, message) ⇒ Object
- target
-
message target (targets starting with * will be labelled WHOCARES
- message
-
message to send
This prioritizes output to help reduce lag when lots of output is being sent to another target. This will automatically decide how to queue the message based on the target
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/mod_spox/PriorityQueue.rb', line 22 def priority_queue(target, ) @lock.synchronize do target.downcase! @target_queues[target] = Queue.new unless @target_queues[target] if(target[0].chr == '*') @target_queues[target] << @queues[:WHOCARES] << @target_queues[target] else @target_queues[target] << if(@target_queues[target].size < 2) @queues[:NEW] << @target_queues[target] else @queues[:NORMAL] << @target_queues[target] end end end end |