This is an automated email from the ASF dual-hosted git repository. rubys pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push: new c34bd68 more restart options c34bd68 is described below commit c34bd68669254ae0afc7dffd9157ae038b868cee Author: Sam Ruby <ru...@intertwingly.net> AuthorDate: Sun Oct 16 10:13:34 2016 -0400 more restart options --- www/board/agenda/daemon/wss.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/www/board/agenda/daemon/wss.rb b/www/board/agenda/daemon/wss.rb index 3fb82a7..e201d32 100755 --- a/www/board/agenda/daemon/wss.rb +++ b/www/board/agenda/daemon/wss.rb @@ -76,10 +76,14 @@ exit 0 if options.kill # Restart when source file changes # ######################################################################## -listener = Listen.to(__dir__) do |modified, added, removed| +def restart_process puts 'restarting' exec RbConfig.ruby, File.expand_path(__FILE__), *ARGV end + +listener = Listen.to(__dir__) do |modified, added, removed| + restart_process +end listener.start ######################################################################## @@ -104,7 +108,14 @@ if options.privkey and options.chain } end +active = Time.now + EM.run do + # restart once an hour when inactive + EM.add_periodic_timer(900) do + restart_process if Time.now - active >= 3600 + end + WebSocket::EventMachine::Server.start(server_options) do |ws| ws.onclose do Channel.delete ws @@ -118,6 +129,7 @@ EM.run do if headers['session'] session = Session[headers['session']] if session + restart_process if headers['restart'] Channel.add ws, session[:id] ws.send JSON.dump(session.merge type: 'login') end @@ -131,6 +143,8 @@ EM.run do Channel.post_all msg end end + + active = Time.now end end end -- To stop receiving notification emails like this one, please contact ['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].