Module OpenWFE::WorkqueueMixin
In: lib/openwfe/util/workqueue.rb

This mixin provides a workqueue and a thread for executing tasks pushed onto it. It uses the thread.rb Queue class.

It is currently only used by the ExpressionPool (maybe it‘ll get merged back into it later).

Methods

Public Instance methods

Returns true if there is or there just was activity for the work queue.

[Source]

    # File lib/openwfe/util/workqueue.rb, line 76
76:         def is_workqueue_busy?
77:             
78:             @workqueue.size > 0
79:         end

the method called by the mixer to actually queue the work.

[Source]

     # File lib/openwfe/util/workqueue.rb, line 92
 92:         def queue_work (*args)
 93: 
 94:             if @workqueue_stopped
 95: 
 96:                 do_process_workelement args
 97:                     #
 98:                     # degraded mode : as if there were no workqueue
 99:             else
100: 
101:                 @workqueue.push args
102:                     #
103:                     # work will be done later (millisec order)
104:                     # by the work thread
105:             end
106:         end

Creates and starts the workqueue.

[Source]

    # File lib/openwfe/util/workqueue.rb, line 58
58:         def start_workqueue
59: 
60:             @workqueue = Queue.new
61: 
62:             @workstopped = false
63: 
64:             OpenWFE::call_in_thread "workqueue", self do
65:                 loop do
66:                     do_process_workelement @workqueue.pop
67:                     break if @workstopped and @workqueue.empty?
68:                 end
69:             end
70:         end

Stops the workqueue.

[Source]

    # File lib/openwfe/util/workqueue.rb, line 84
84:         def stop_workqueue
85: 
86:             @workstopped = true
87:         end

[Validate]