mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-07 22:21:47 +00:00
added SpoolProc class in uwsgidsl.rb
This commit is contained in:
+18
@@ -14,6 +14,7 @@ end
|
||||
|
||||
$postfork_chain = []
|
||||
$mulefunc_list = []
|
||||
$spoolfunc_list = []
|
||||
|
||||
module UWSGI
|
||||
module_function
|
||||
@@ -21,6 +22,11 @@ module UWSGI
|
||||
$postfork_chain.each {|func| func.call }
|
||||
end
|
||||
|
||||
module_function
|
||||
def spooler(args)
|
||||
$spoolfunc_list[args['ud_spool_func'].to_i].call(args)
|
||||
end
|
||||
|
||||
module_function
|
||||
def mule_msg_hook(message)
|
||||
service = Marshal.load(message)
|
||||
@@ -62,6 +68,18 @@ def postfork(&block)
|
||||
$postfork_chain << block
|
||||
end
|
||||
|
||||
class SpoolProc < Proc
|
||||
def initialize(&block)
|
||||
@block = block
|
||||
@id = (($spoolfunc_list << block).length-1).to_s
|
||||
end
|
||||
|
||||
def call(args)
|
||||
args['ud_spool_func'] = @id
|
||||
UWSGI::send_to_spooler(args)
|
||||
end
|
||||
end
|
||||
|
||||
def rpc(name, &block)
|
||||
if block.arity <= 0
|
||||
UWSGI.register_rpc(name, block, 0)
|
||||
|
||||
Reference in New Issue
Block a user