From 111fe5ef983215727b65547120934502f4a0f306 Mon Sep 17 00:00:00 2001 From: "BOYA,CHIU" Date: Wed, 11 Aug 2021 16:16:21 +0800 Subject: [PATCH] fix bug --- announcement.gemspec | 5 ++++- app/controllers/announcements_controller.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/announcement.gemspec b/announcement.gemspec index 5f376e8..0174eba 100644 --- a/announcement.gemspec +++ b/announcement.gemspec @@ -5,6 +5,7 @@ $:.push File.expand_path("../lib", __FILE__) require "announcement/version" require 'json' bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install' +puts ['rails_env',ENV.to_h] if bundle_update_flag env_pwd = ENV['PWD'] if File.exist?("#{env_pwd}/app/models/google.rb") @@ -200,11 +201,13 @@ if bundle_update_flag #file.write(all_command) #file.chmod(0755) #file.close + restart_cmd = "UNICORN_PID=\"`fuser fuser tmp/pids/unicorn.sock tmp/sockets/unicorn.sock tmp/unicorn.sock` `cat tmp/pids/unicorn.pid `\" && kill -s TERM $UNICORN_PID ; while (kill -0 $UNICORN_PID > /dev/null 2>&1) ; do printf '.' && sleep 1 ; done ; unset UNICORN_FD; bundle exec unicorn_rails -c config/unicorn.rb -D -E #{mode}" + a = Thread.start do Bundler.with_clean_env do puts env_pwd puts mode - exec("cd #{env_pwd} && env -i HOME=\"$HOME\" bash -l -c \"#{all_command}\" ;screen -d -m -S auto_reopen_#{dir_name} bash -c \"#{use_cmd} kill -s TERM `cat tmp/pids/unicorn.pid` ; unset UNICORN_FD ; bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode};#{watch_dog_cmd}\" ") + exec("cd #{env_pwd} && env -i HOME=\"$HOME\" bash -l -c \"#{all_command}\" ;screen -d -m -S auto_reopen_#{dir_name} bash -c \"#{use_cmd} #{restart_cmd};#{watch_dog_cmd}\" ") end end now_priority = Thread.current.priority.to_i diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 6f4d3b7..069748b 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -59,6 +59,7 @@ class AnnouncementsController < ApplicationController a end end + params = OrbitHelper.params if anns.count == 0 && params.any?{|k,v| v.class==Array ? v.any?{|v1| v1.to_s.match(/\*|\(|\)/)} : v.to_s.match(/\*|\(|\)/)} return nil end @@ -68,7 +69,6 @@ class AnnouncementsController < ApplicationController end # anns = anns.concat(feeds_anns) # total_pages = announcements.total_pages - params = OrbitHelper.params page = Page.where(url:params['url']).first @annc_page_title = nil if (params['category'] != page.categories rescue true)