Fixes #3304: Sessions::Node don't do any work if ZAMMAD_SESSION_JOBS_CONCURRENT was higher and got lowered.

This commit is contained in:
Thorsten Eckel 2020-11-27 09:38:55 +01:00
parent f0fa4a6f9b
commit dd192ed572

View file

@ -621,6 +621,12 @@ delete spool messages
# dispatch sessions # dispatch sessions
if node_id.blank? && ENV['ZAMMAD_SESSION_JOBS_CONCURRENT'].to_i.positive? if node_id.blank? && ENV['ZAMMAD_SESSION_JOBS_CONCURRENT'].to_i.positive?
previous_nodes_sessions = Sessions::Node.stats
if previous_nodes_sessions.present?
log('info', "Cleaning up previous Sessions::Node sessions: #{previous_nodes_sessions}")
Sessions::Node.cleanup
end
dispatcher_pid = Process.pid dispatcher_pid = Process.pid
node_count = ENV['ZAMMAD_SESSION_JOBS_CONCURRENT'].to_i node_count = ENV['ZAMMAD_SESSION_JOBS_CONCURRENT'].to_i
node_pids = [] node_pids = []
@ -649,7 +655,7 @@ delete spool messages
raise SignalException, 'SIGTERM' raise SignalException, 'SIGTERM'
end end
# displatch client_ids to nodes # dispatch client_ids to nodes
loop do loop do
# nodes # nodes
@ -661,7 +667,7 @@ delete spool messages
# ask nodes for nodes # ask nodes for nodes
next if nodes_stats[client_id] next if nodes_stats[client_id]
# assigne to node # assign to node
Sessions::Node.session_assigne(client_id) Sessions::Node.session_assigne(client_id)
sleep 1 sleep 1
end end