Move to sidekiq

This commit is contained in:
Wedge 2016-05-28 21:21:02 +03:00
parent 9137744c69
commit ac1b4b583d
51 changed files with 377 additions and 624 deletions

View File

@ -1,8 +0,0 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb', 'vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks

15
Gemfile
View File

@ -10,11 +10,15 @@ gem 'devise'
gem 'pundit' gem 'pundit'
gem 'paperclip' gem 'paperclip'
gem 'resque' gem 'sinatra', :require => nil
gem 'resque-status' gem 'sidekiq'
gem 'resque_mailer' gem 'kiqit'
gem 'resque-scheduler', '~>2.5.4' gem 'sidekiq-scheduler', '~> 2.0'
gem 'perform_later', git: 'git://github.com/KensoDev/perform_later.git' # should be after resque_mailer #gem 'resque'
#gem 'resque-status'
#gem 'resque_mailer'
#gem 'resque-scheduler', '~>2.5.4'
#gem 'perform_later', git: 'git://github.com/KensoDev/perform_later.git' # should be after resque_mailer
gem 'russian' gem 'russian'
gem 'state_machines-activerecord' gem 'state_machines-activerecord'
gem 'redis-rails' gem 'redis-rails'
@ -79,6 +83,7 @@ group :development do
gem 'rails3-generators' gem 'rails3-generators'
gem 'hirb' gem 'hirb'
gem 'shotgun' gem 'shotgun'
gem 'state_machines-graphviz'
# Better Errors & RailsPanel # Better Errors & RailsPanel
gem 'better_errors' gem 'better_errors'
gem 'binding_of_caller' gem 'binding_of_caller'

View File

@ -1,13 +1,3 @@
GIT
remote: git://github.com/KensoDev/perform_later.git
revision: afd40794aa7101c8e73e9f105a064dd9bec47e31
specs:
perform_later (1.3.0)
rails (>= 3.0)
redis
resque (> 1.25)
resque-scheduler
GIT GIT
remote: git://github.com/activeadmin/activeadmin.git remote: git://github.com/activeadmin/activeadmin.git
revision: cce908d9793ba1fce8483afe5e4112f97d7d0857 revision: cce908d9793ba1fce8483afe5e4112f97d7d0857
@ -122,6 +112,7 @@ GEM
sass-rails (< 5.1) sass-rails (< 5.1)
sprockets (< 4.0) sprockets (< 4.0)
concurrent-ruby (1.0.2) concurrent-ruby (1.0.2)
connection_pool (2.2.0)
crack (0.4.3) crack (0.4.3)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
daemons (1.2.3) daemons (1.2.3)
@ -202,6 +193,9 @@ GEM
actionpack (>= 3.0.0) actionpack (>= 3.0.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
key_struct (0.4.2) key_struct (0.4.2)
kiqit (2.4.0)
activerecord
sidekiq (> 2.5)
libv8 (3.16.14.15) libv8 (3.16.14.15)
localeapp (1.0.2) localeapp (1.0.2)
gli gli
@ -237,7 +231,6 @@ GEM
modware (0.1.2) modware (0.1.2)
its-it its-it
key_struct (~> 0.4) key_struct (~> 0.4)
mono_logger (1.1.0)
multi_json (1.12.1) multi_json (1.12.1)
multipart-post (2.0.0) multipart-post (2.0.0)
nest (1.1.2) nest (1.1.2)
@ -326,7 +319,7 @@ GEM
rb-fsevent (0.9.7) rb-fsevent (0.9.7)
rb-inotify (0.9.7) rb-inotify (0.9.7)
ffi (>= 0.5.0) ffi (>= 0.5.0)
redis (3.0.7) redis (3.3.0)
redis-actionpack (4.0.1) redis-actionpack (4.0.1)
actionpack (~> 4) actionpack (~> 4)
redis-rack (~> 1.5.0) redis-rack (~> 1.5.0)
@ -334,8 +327,6 @@ GEM
redis-activesupport (4.1.5) redis-activesupport (4.1.5)
activesupport (>= 3, < 5) activesupport (>= 3, < 5)
redis-store (~> 1.1.0) redis-store (~> 1.1.0)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
redis-rack (1.5.0) redis-rack (1.5.0)
rack (~> 1.5) rack (~> 1.5)
redis-store (~> 1.1.0) redis-store (~> 1.1.0)
@ -350,21 +341,6 @@ GEM
ref (2.0.0) ref (2.0.0)
responders (2.2.0) responders (2.2.0)
railties (>= 4.2.0, < 5.1) railties (>= 4.2.0, < 5.1)
resque (1.25.2)
mono_logger (~> 1.0)
multi_json (~> 1.0)
redis-namespace (~> 1.3)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
resque-scheduler (2.5.5)
mono_logger (~> 1.0)
redis (~> 3.0.4)
resque (~> 1.25.1)
rufus-scheduler (~> 2.0.24)
resque-status (0.5.0)
resque (~> 1.19)
resque_mailer (2.3.0)
actionmailer (>= 3.0)
rest-client (1.8.0) rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0) mime-types (>= 1.16, < 3.0)
@ -387,13 +363,13 @@ GEM
rspec-mocks (~> 3.4.0) rspec-mocks (~> 3.4.0)
rspec-support (~> 3.4.0) rspec-support (~> 3.4.0)
rspec-support (3.4.1) rspec-support (3.4.1)
ruby-graphviz (1.2.2)
ruby-haml-js (0.0.5) ruby-haml-js (0.0.5)
execjs execjs
sprockets (>= 2.0.0) sprockets (>= 2.0.0)
ruby_parser (3.8.2) ruby_parser (3.8.2)
sexp_processor (~> 4.1) sexp_processor (~> 4.1)
rufus-scheduler (2.0.24) rufus-scheduler (3.1.10)
tzinfo (>= 0.3.22)
russian (0.6.0) russian (0.6.0)
i18n (>= 0.5.0) i18n (>= 0.5.0)
safe_yaml (1.0.4) safe_yaml (1.0.4)
@ -470,6 +446,16 @@ GEM
shoulda-context (1.2.1) shoulda-context (1.2.1)
shoulda-matchers (2.8.0) shoulda-matchers (2.8.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
sidekiq (4.1.2)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
redis (~> 3.2, >= 3.2.1)
sidekiq-scheduler (2.0.7)
multi_json (~> 1)
redis (~> 3)
rufus-scheduler (~> 3.1.8)
sidekiq (>= 3)
tilt (>= 1.4.0)
simple_form (3.1.0.rc2) simple_form (3.1.0.rc2)
actionpack (~> 4.0) actionpack (~> 4.0)
activemodel (~> 4.0) activemodel (~> 4.0)
@ -477,8 +463,6 @@ GEM
rack (~> 1.5) rack (~> 1.5)
rack-protection (~> 1.4) rack-protection (~> 1.4)
tilt (>= 1.3, < 3) tilt (>= 1.3, < 3)
sitemap_generator (5.1.0)
builder
skinny (0.2.4) skinny (0.2.4)
eventmachine (~> 1.0.0) eventmachine (~> 1.0.0)
thin (>= 1.5, < 1.7) thin (>= 1.5, < 1.7)
@ -501,6 +485,9 @@ GEM
state_machines-activerecord (0.4.0) state_machines-activerecord (0.4.0)
activerecord (>= 4.1, < 5.1) activerecord (>= 4.1, < 5.1)
state_machines-activemodel (>= 0.3.0) state_machines-activemodel (>= 0.3.0)
state_machines-graphviz (0.0.2)
ruby-graphviz
state_machines
temple (0.7.7) temple (0.7.7)
test_after_commit (1.0.0) test_after_commit (1.0.0)
activerecord (>= 3.2) activerecord (>= 3.2)
@ -526,8 +513,6 @@ GEM
unf_ext unf_ext
unf_ext (0.0.7.2) unf_ext (0.0.7.2)
valuable (0.9.12) valuable (0.9.12)
vegas (0.1.11)
rack (>= 1.0.0)
warden (1.2.6) warden (1.2.6)
rack (>= 1.0) rack (>= 1.0)
webmock (2.0.3) webmock (2.0.3)
@ -559,6 +544,7 @@ DEPENDENCIES
hirb hirb
jbuilder jbuilder
js-routes js-routes
kiqit
localeapp localeapp
mailcatcher mailcatcher
meta-tags meta-tags
@ -571,7 +557,6 @@ DEPENDENCIES
ohm (~> 1.3.2) ohm (~> 1.3.2)
ohm-expire (~> 0.1.3) ohm-expire (~> 0.1.3)
paperclip paperclip
perform_later!
pg pg
puma puma
pundit pundit
@ -585,10 +570,6 @@ DEPENDENCIES
rake rake
redis-rails redis-rails
redis-semaphore redis-semaphore
resque
resque-scheduler (~> 2.5.4)
resque-status
resque_mailer
rest-client rest-client
rr rr
rspec-rails rspec-rails
@ -599,12 +580,15 @@ DEPENDENCIES
shotgun shotgun
shoulda shoulda
shoulda-matchers shoulda-matchers
sidekiq
sidekiq-scheduler (~> 2.0)
simple_form (= 3.1.0.rc2) simple_form (= 3.1.0.rc2)
sitemap_generator sinatra
slim slim
soundmanager-rails soundmanager-rails
sprockets sprockets
state_machines-activerecord state_machines-activerecord
state_machines-graphviz
test_after_commit test_after_commit
therubyracer therubyracer
therubyrhino therubyrhino

View File

@ -3,7 +3,5 @@
require File.expand_path('../config/application', __FILE__) require File.expand_path('../config/application', __FILE__)
require 'rake' require 'rake'
require 'resque/tasks'
require 'resque_scheduler/tasks'
Rosa::Application.load_tasks Rosa::Application.load_tasks

View File

@ -1,3 +0,0 @@
ActiveAdmin.register_page 'Resque' do
menu priority: 100, label: 'Resque', url: '/admin/resque/overview'
end

View File

@ -1,190 +0,0 @@
angular.module("u2i.bootstrap.tpls", ["uib/template/tabs/tab.html", "uib/template/tabs/tabset.html", "uib/template/typeahead/typeahead-match.html",
"uib/template/typeahead/typeahead-popup.html", "uib/template/pagination/pager.html",
"uib/template/pagination/pagination.html", "uib/template/datepicker/datepicker.html",
"uib/template/datepicker/popup.html", "uib/template/datepicker/year.html",
"uib/template/datepicker/month.html", "uib/template/datepicker/day.html"]);
angular.module("uib/template/tabs/tab.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/tabs/tab.html",
"<li ng-class=\"[{active: active, disabled: disabled}, classes]\" class=\"uib-tab nav-item\">\n" +
" <a href ng-click=\"select($event)\" class=\"nav-link\" uib-tab-heading-transclude>{{heading}}</a>\n" +
"</li>\n" +
"");
}]);
angular.module("uib/template/tabs/tabset.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/tabs/tabset.html",
"<div>\n" +
" <ul class=\"nav nav-{{tabset.type || 'tabs'}} bottom-space\" ng-class=\"{'nav-stacked': vertical, 'nav-justified': justified}\" ng-transclude></ul>\n" +
" <div class=\"tab-content\">\n" +
" <div class=\"tab-pane\"\n" +
" ng-repeat=\"tab in tabset.tabs\"\n" +
" ng-class=\"{active: tabset.active === tab.index}\"\n" +
" uib-tab-content-transclude=\"tab\">\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/typeahead/typeahead-match.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/typeahead/typeahead-match.html",
"<a href\n" +
" tabindex=\"-1\"\n" +
" ng-bind-html=\"match.label | uibTypeaheadHighlight:query\"\n" +
" ng-attr-title=\"{{match.label}}\"></a>\n" +
"");
}]);
angular.module("uib/template/typeahead/typeahead-popup.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/typeahead/typeahead-popup.html",
"<ul class=\"dropdown-menu\" ng-show=\"isOpen() && !moveInProgress\" ng-style=\"{top: position().top+'px', left: position().left+'px'}\" role=\"listbox\" aria-hidden=\"{{!isOpen()}}\">\n" +
" <li ng-repeat=\"match in matches track by $index\" ng-class=\"{active: isActive($index) }\" ng-mouseenter=\"selectActive($index)\" ng-click=\"selectMatch($index, $event)\" role=\"option\" id=\"{{::match.id}}\">\n" +
" <div uib-typeahead-match index=\"$index\" match=\"match\" query=\"query\" template-url=\"templateUrl\"></div>\n" +
" </li>\n" +
"</ul>\n" +
"");
}]);
angular.module("uib/template/pagination/pager.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/pagination/pager.html",
"<ul class=\"pager\">\n" +
" <li ng-class=\"{disabled: noPrevious()||ngDisabled, previous: align}\"><a href ng-click=\"selectPage(page - 1, $event)\">{{::getText('previous')}}</a></li>\n" +
" <li ng-class=\"{disabled: noNext()||ngDisabled, next: align}\"><a href ng-click=\"selectPage(page + 1, $event)\">{{::getText('next')}}</a></li>\n" +
"</ul>\n" +
"");
}]);
angular.module("uib/template/pagination/pagination.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/pagination/pagination.html",
"<ul class=\"pagination\">\n" +
" <li ng-if=\"::boundaryLinks\" ng-class=\"{disabled: noPrevious()||ngDisabled}\" class=\"pagination-first\"><a href ng-click=\"selectPage(1, $event)\">{{::getText('first')}}</a></li>\n" +
" <li ng-if=\"::directionLinks\" ng-class=\"{disabled: noPrevious()||ngDisabled}\" class=\"pagination-prev\"><a href ng-click=\"selectPage(page - 1, $event)\">{{::getText('previous')}}</a></li>\n" +
" <li ng-repeat=\"page in pages track by $index\" ng-class=\"{active: page.active,disabled: ngDisabled&&!page.active}\" class=\"pagination-page\"><a href ng-click=\"selectPage(page.number, $event)\">{{page.text}}</a></li>\n" +
" <li ng-if=\"::directionLinks\" ng-class=\"{disabled: noNext()||ngDisabled}\" class=\"pagination-next\"><a href ng-click=\"selectPage(page + 1, $event)\">{{::getText('next')}}</a></li>\n" +
" <li ng-if=\"::boundaryLinks\" ng-class=\"{disabled: noNext()||ngDisabled}\" class=\"pagination-last\"><a href ng-click=\"selectPage(totalPages, $event)\">{{::getText('last')}}</a></li>\n" +
"</ul>\n" +
"");
}]);
angular.module("uib/template/datepicker/datepicker.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/datepicker.html",
"<div class=\"uib-datepicker\" ng-switch=\"datepickerMode\" role=\"application\" ng-keydown=\"keydown($event)\">\n" +
" <uib-daypicker ng-switch-when=\"day\" tabindex=\"0\"></uib-daypicker>\n" +
" <uib-monthpicker ng-switch-when=\"month\" tabindex=\"0\"></uib-monthpicker>\n" +
" <uib-yearpicker ng-switch-when=\"year\" tabindex=\"0\"></uib-yearpicker>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/datepicker/day.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/day.html",
"<table class=\"uib-daypicker\" role=\"grid\" aria-labelledby=\"{{::uniqueId}}-title\" aria-activedescendant=\"{{activeDateId}}\">\n" +
" <thead>\n" +
" <tr>\n" +
" <th><button type=\"button\" class=\"btn btn-default btn-sm pull-left uib-left\" ng-click=\"move(-1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-left\"></i></button></th>\n" +
" <th colspan=\"{{::5 + showWeeks}}\"><button id=\"{{::uniqueId}}-title\" role=\"heading\" aria-live=\"assertive\" aria-atomic=\"true\" type=\"button\" class=\"btn btn-default btn-sm uib-title\" ng-click=\"toggleMode()\" ng-disabled=\"datepickerMode === maxMode\" tabindex=\"-1\"><strong>{{title}}</strong></button></th>\n" +
" <th><button type=\"button\" class=\"btn btn-default btn-sm pull-right uib-right\" ng-click=\"move(1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-right\"></i></button></th>\n" +
" </tr>\n" +
" <tr>\n" +
" <th ng-if=\"showWeeks\" class=\"text-center\"></th>\n" +
" <th ng-repeat=\"label in ::labels track by $index\" class=\"text-center\"><small aria-label=\"{{::label.full}}\">{{::label.abbr}}</small></th>\n" +
" </tr>\n" +
" </thead>\n" +
" <tbody>\n" +
" <tr class=\"uib-weeks\" ng-repeat=\"row in rows track by $index\">\n" +
" <td ng-if=\"showWeeks\" class=\"text-center h6\"><em>{{ weekNumbers[$index] }}</em></td>\n" +
" <td ng-repeat=\"dt in row\" class=\"uib-day text-center\" role=\"gridcell\"\n" +
" id=\"{{::dt.uid}}\"\n" +
" ng-class=\"::dt.customClass\">\n" +
" <button type=\"button\" class=\"btn btn-default btn-sm\"\n" +
" uib-is-class=\"\n" +
" 'btn-info' for selectedDt,\n" +
" 'active' for activeDt\n" +
" on dt\"\n" +
" ng-click=\"select(dt.date)\"\n" +
" ng-disabled=\"::dt.disabled\"\n" +
" tabindex=\"-1\"><span ng-class=\"::{'text-muted': dt.secondary, 'text-info': dt.current}\">{{::dt.label}}</span></button>\n" +
" </td>\n" +
" </tr>\n" +
" </tbody>\n" +
"</table>\n" +
"");
}]);
angular.module("uib/template/datepicker/month.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/month.html",
"<table class=\"uib-monthpicker\" role=\"grid\" aria-labelledby=\"{{::uniqueId}}-title\" aria-activedescendant=\"{{activeDateId}}\">\n" +
" <thead>\n" +
" <tr>\n" +
" <th><button type=\"button\" class=\"btn btn-default btn-sm pull-left uib-left\" ng-click=\"move(-1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-left\"></i></button></th>\n" +
" <th><button id=\"{{::uniqueId}}-title\" role=\"heading\" aria-live=\"assertive\" aria-atomic=\"true\" type=\"button\" class=\"btn btn-default btn-sm uib-title\" ng-click=\"toggleMode()\" ng-disabled=\"datepickerMode === maxMode\" tabindex=\"-1\"><strong>{{title}}</strong></button></th>\n" +
" <th><button type=\"button\" class=\"btn btn-default btn-sm pull-right uib-right\" ng-click=\"move(1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-right\"></i></button></th>\n" +
" </tr>\n" +
" </thead>\n" +
" <tbody>\n" +
" <tr class=\"uib-months\" ng-repeat=\"row in rows track by $index\">\n" +
" <td ng-repeat=\"dt in row\" class=\"uib-month text-center\" role=\"gridcell\"\n" +
" id=\"{{::dt.uid}}\"\n" +
" ng-class=\"::dt.customClass\">\n" +
" <button type=\"button\" class=\"btn btn-default\"\n" +
" uib-is-class=\"\n" +
" 'btn-info' for selectedDt,\n" +
" 'active' for activeDt\n" +
" on dt\"\n" +
" ng-click=\"select(dt.date)\"\n" +
" ng-disabled=\"::dt.disabled\"\n" +
" tabindex=\"-1\"><span ng-class=\"::{'text-info': dt.current}\">{{::dt.label}}</span></button>\n" +
" </td>\n" +
" </tr>\n" +
" </tbody>\n" +
"</table>\n" +
"");
}]);
angular.module("uib/template/datepicker/popup.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/popup.html",
"<div>\n" +
" <ul class=\"uib-datepicker-popup dropdown-menu uib-position-measure\" dropdown-nested ng-if=\"isOpen\" ng-keydown=\"keydown($event)\" ng-click=\"$event.stopPropagation()\">\n" +
" <li ng-transclude></li>\n" +
" <li ng-if=\"showButtonBar\" class=\"uib-button-bar\">\n" +
" <span class=\"btn-group pull-left\">\n" +
" <button type=\"button\" class=\"btn btn-sm btn-info uib-datepicker-current\" ng-click=\"select('today', $event)\" ng-disabled=\"isDisabled('today')\">{{ getText('current') }}</button>\n" +
" <button type=\"button\" class=\"btn btn-sm btn-danger uib-clear\" ng-click=\"select(null, $event)\">{{ getText('clear') }}</button>\n" +
" </span>\n" +
" <button type=\"button\" class=\"btn btn-sm btn-success pull-right uib-close\" ng-click=\"close($event)\">{{ getText('close') }}</button>\n" +
" </li>\n" +
" </ul>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/datepicker/year.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/year.html",
"<table class=\"uib-yearpicker\" role=\"grid\" aria-labelledby=\"{{::uniqueId}}-title\" aria-activedescendant=\"{{activeDateId}}\">\n" +
" <thead>\n" +
" <tr>\n" +
" <th><button type=\"button\" class=\"btn btn-default btn-sm pull-left uib-left\" ng-click=\"move(-1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-left\"></i></button></th>\n" +
" <th colspan=\"{{::columns - 2}}\"><button id=\"{{::uniqueId}}-title\" role=\"heading\" aria-live=\"assertive\" aria-atomic=\"true\" type=\"button\" class=\"btn btn-default btn-sm uib-title\" ng-click=\"toggleMode()\" ng-disabled=\"datepickerMode === maxMode\" tabindex=\"-1\"><strong>{{title}}</strong></button></th>\n" +
" <th><button type=\"button\" class=\"btn btn-default btn-sm pull-right uib-right\" ng-click=\"move(1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-right\"></i></button></th>\n" +
" </tr>\n" +
" </thead>\n" +
" <tbody>\n" +
" <tr class=\"uib-years\" ng-repeat=\"row in rows track by $index\">\n" +
" <td ng-repeat=\"dt in row\" class=\"uib-year text-center\" role=\"gridcell\"\n" +
" id=\"{{::dt.uid}}\"\n" +
" ng-class=\"::dt.customClass\">\n" +
" <button type=\"button\" class=\"btn btn-default\"\n" +
" uib-is-class=\"\n" +
" 'btn-info' for selectedDt,\n" +
" 'active' for activeDt\n" +
" on dt\"\n" +
" ng-click=\"select(dt.date)\"\n" +
" ng-disabled=\"::dt.disabled\"\n" +
" tabindex=\"-1\"><span ng-class=\"::{'text-info': dt.current}\">{{::dt.label}}</span></button>\n" +
" </td>\n" +
" </tr>\n" +
" </tbody>\n" +
"</table>\n" +
"");
}]);

View File

@ -91,7 +91,7 @@ class Api::V1::JobsController < Api::V1::BaseController
if QUEUES.include?(worker_queue) && QUEUE_CLASSES.include?(worker_class) if QUEUES.include?(worker_queue) && QUEUE_CLASSES.include?(worker_class)
worker_args = (params[:worker_args] || []).first || {} worker_args = (params[:worker_args] || []).first || {}
worker_args = worker_args.merge(feedback_from_user: current_user.id) worker_args = worker_args.merge(feedback_from_user: current_user.id)
Resque.push worker_queue, 'class' => worker_class, 'args' => [worker_args] Sidekiq::Client.push 'queue' => worker_queue, 'class' => worker_class, 'args' => [worker_args]
render nothing: true render nothing: true
else else
render nothing: true, status: 403 render nothing: true, status: 403

View File

@ -88,7 +88,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
@product_build_lists = @product_build_lists. @product_build_lists = @product_build_lists.
includes(:project, product: :platform). includes(:project, product: :platform).
recent.paginate(page: current_page) recent.paginate(page: current_page)
@build_server_status = AbfWorkerStatusPresenter.new.products_status #@build_server_status = AbfWorkerStatusPresenter.new.products_status
end end
protected protected

View File

@ -35,7 +35,7 @@ class Projects::BuildListsController < Projects::BaseController
:source_packages, :source_packages,
project: :project_statistics) project: :project_statistics)
@build_server_status = AbfWorkerStatusPresenter.new.projects_status #@build_server_status = AbfWorkerStatusPresenter.new.projects_status
end end
end end
end end
@ -103,21 +103,21 @@ class Projects::BuildListsController < Projects::BaseController
if prs.present? && prs[:projects].present? && prs[:arches].present? if prs.present? && prs[:projects].present? && prs[:arches].present?
project_ids = prs[:projects].select{ |k, v| v == '1' }.keys project_ids = prs[:projects].select{ |k, v| v == '1' }.keys
arch_ids = prs[:arches]. select{ |k, v| v == '1' }.keys arch_ids = prs[:arches]. select{ |k, v| v == '1' }.keys
#FIX
Resque.enqueue( # enqueue(
BuildLists::DependentPackagesJob, # BuildLists::DependentPackagesJob,
@build_list.id, # @build_list.id,
current_user.id, # current_user.id,
project_ids, # project_ids,
arch_ids, # arch_ids,
{ # {
auto_publish_status: prs[:auto_publish_status], # auto_publish_status: prs[:auto_publish_status],
auto_create_container: prs[:auto_create_container], # auto_create_container: prs[:auto_create_container],
include_testing_subrepository: prs[:include_testing_subrepository], # include_testing_subrepository: prs[:include_testing_subrepository],
use_cached_chroot: prs[:use_cached_chroot], # use_cached_chroot: prs[:use_cached_chroot],
use_extra_tests: prs[:use_extra_tests] # use_extra_tests: prs[:use_extra_tests]
} # }
) # )
flash[:notice] = t('flash.build_list.dependent_projects_job_added_to_queue') flash[:notice] = t('flash.build_list.dependent_projects_job_added_to_queue')
redirect_to build_list_path(@build_list) redirect_to build_list_path(@build_list)
end end

View File

@ -1,5 +1,7 @@
module AbfWorker module AbfWorker
class BaseObserver class BaseObserver < BaseActiveRecordJob
include Sidekiq::Worker
COMPLETED = 0 COMPLETED = 0
FAILED = 1 FAILED = 1
PENDING = 2 PENDING = 2
@ -9,13 +11,13 @@ module AbfWorker
attr_accessor :status, :options attr_accessor :status, :options
def initialize(options, subject_class) def perform(options)
@status = options['status'].to_i @status = options['status'].to_i
@options = options @options = options
@subject_class = subject_class real_perform
end end
def perform def real_perform
raise NotImplementedError, "You should implement this method" raise NotImplementedError, "You should implement this method"
end end

View File

@ -1,30 +1,29 @@
module AbfWorker module AbfWorker
class IsoWorkerObserver < AbfWorker::BaseObserver class IsoWorkerObserver < AbfWorker::BaseObserver
@queue = :iso_worker_observer sidekiq_options :queue => :iso_worker_observer
def self.perform(options) def real_perform
new(options, ProductBuildList).perform @subject_class = ProductBuildList
end subject.with_lock do
case status
when COMPLETED
subject.build_success
when FAILED
def perform case options['exit_status'].to_i
case status when ProductBuildList::BUILD_COMPLETED_PARTIALLY
when COMPLETED subject.build_success_partially
subject.build_success else
when FAILED subject.build_error
end
case options['exit_status'].to_i when STARTED
when ProductBuildList::BUILD_COMPLETED_PARTIALLY subject.start_build
subject.build_success_partially when CANCELED
else subject.build_canceled
subject.build_error
end end
update_results if status != STARTED
when STARTED
subject.start_build
when CANCELED
subject.build_canceled
end end
update_results if status != STARTED
end end
end end

View File

@ -1,12 +1,9 @@
module AbfWorker module AbfWorker
class PublishObserver < AbfWorker::BaseObserver class PublishObserver < AbfWorker::BaseObserver
@queue = :publish_observer sidekiq_options :queue => :publish_observer
def self.perform(options) def real_perform
new(options, BuildList).perform @subject_class = BuildList
end
def perform
return if status == STARTED # do nothing when publication started return if status == STARTED # do nothing when publication started
extra = options['extra'] extra = options['extra']
repository_status = RepositoryStatus.where(id: extra['repository_status_id']).first repository_status = RepositoryStatus.where(id: extra['repository_status_id']).first

View File

@ -7,88 +7,73 @@ module AbfWorker
# other - Build error # other - Build error
EXIT_CODE_UNPERMITTED_ARCHITECTURE = 6 EXIT_CODE_UNPERMITTED_ARCHITECTURE = 6
@queue = :rpm_worker_observer sidekiq_options :queue => :rpm_worker_observer
def self.perform(options) def real_perform
new(options, BuildList).perform @subject_class = BuildList
end subject.with_lock do
unless subject.valid? && restart_task
if options['feedback_from_user']
user = User.find options['feedback_from_user']
raise ActiveRecord::Rollback if !user.system? && subject.builder != user
end
def perform fill_container_data if status != STARTED
return if subject.valid? && restart_task
if options['feedback_from_user']
user = User.find options['feedback_from_user']
return if !user.system? && subject.builder != user
end
item = find_or_create_item unless subject.valid?
fill_container_data if status != STARTED subject.build_error(false)
subject.save(validate: false)
return
end
unless subject.valid? if options['hostname']
item.update_attributes({status: BuildList::BUILD_ERROR}) subject.update_attribute(:hostname, options['hostname'])
subject.build_error(false) end
subject.save(validate: false)
return
end
if options['hostname'] if options['fail_reason']
subject.update_attribute(:hostname, options['hostname']) subject.update_attribute(:fail_reason, options['fail_reason'])
end end
if options['fail_reason'] if options['commit_hash']
subject.update_attribute(:fail_reason, options['fail_reason']) subject.update_attribute(:commit_hash, options['commit_hash'])
end end
if options['commit_hash'] rerunning_tests = subject.rerunning_tests?
item.update_attribute(:version, options['commit_hash'])
subject.update_attribute(:commit_hash, options['commit_hash'])
end
rerunning_tests = subject.rerunning_tests? case status
when COMPLETED
subject.build_success
if subject.can_auto_publish? && subject.can_publish?
subject.now_publish
elsif subject.auto_publish_into_testing? && subject.can_publish_into_testing?
subject.publish_into_testing
end
when FAILED
case status case options['exit_status'].to_i
when COMPLETED when EXIT_CODE_UNPERMITTED_ARCHITECTURE
subject.build_success subject.unpermitted_arch
if subject.can_auto_publish? && subject.can_publish? else
subject.now_publish subject.build_error
elsif subject.auto_publish_into_testing? && subject.can_publish_into_testing? end
subject.publish_into_testing
when STARTED
subject.start_build
when CANCELED
subject.build_canceled
when TESTS_FAILED
subject.tests_failed
end
if !rerunning_tests && [TESTS_FAILED, COMPLETED].include?(status)
subject.publish_container if subject.auto_create_container?
end
end end
when FAILED
case options['exit_status'].to_i
when EXIT_CODE_UNPERMITTED_ARCHITECTURE
subject.unpermitted_arch
else
subject.build_error
end
item.update_attributes({status: BuildList::BUILD_ERROR}) unless rerunning_tests
when STARTED
subject.start_build
when CANCELED
item.update_attributes({status: BuildList::BUILD_CANCELED}) unless rerunning_tests || subject.tests_failed?
subject.build_canceled
when TESTS_FAILED
subject.tests_failed
end
if !rerunning_tests && [TESTS_FAILED, COMPLETED].include?(status)
item.update_attributes({status: BuildList::SUCCESS})
subject.publish_container if subject.auto_create_container?
end end
end end
protected protected
def find_or_create_item
subject.items.first || subject.items.create({
version: '',
name: subject.project.name,
status: BuildList::BUILD_STARTED,
level: 0
})
end
def restart_task def restart_task
return false if status != FAILED return false if status != FAILED
if Redis.current.lrem(RESTARTED_BUILD_LISTS, 0, subject.id) > 0 || (options['results'] || []).size > 1 if Redis.current.lrem(RESTARTED_BUILD_LISTS, 0, subject.id) > 0 || (options['results'] || []).size > 1

View File

@ -1,7 +1,7 @@
class AutostartBuildsDailyJob class AutostartBuildsDailyJob < BaseActiveRecordJob
@queue = :low include Sidekiq::Worker
def self.perform def perform_with_ar_connection
Product.autostart_iso_builds_once_a_day Product.autostart_iso_builds_once_a_day
Project.autostart_build_lists_once_a_day Project.autostart_build_lists_once_a_day
end end

View File

@ -1,7 +1,7 @@
class AutostartBuildsOnceEveryTwelveHoursJob class AutostartBuildsOnceEveryTwelveHoursJob < BaseActiveRecordJob
@queue = :low include Sidekiq::Worker
def self.perform def perform_with_ar_connection
Product.autostart_iso_builds_once_a_12_hours Product.autostart_iso_builds_once_a_12_hours
Project.autostart_build_lists_once_a_12_hours Project.autostart_build_lists_once_a_12_hours
end end

View File

@ -1,7 +1,7 @@
class AutostartBuildsWeeklyJob class AutostartBuildsWeeklyJob < BaseActiveRecordJob
@queue = :low include Sidekiq::Worker
def self.perform def perform_with_ar_connection
Product.autostart_iso_builds_once_a_week Product.autostart_iso_builds_once_a_week
Project.autostart_build_lists_once_a_week Project.autostart_build_lists_once_a_week
end end

View File

@ -0,0 +1,10 @@
class BaseActiveRecordJob
def perform(*args)
ActiveRecord::Base.connection_pool.with_connection do
perform_with_ar_connection(*args)
end
ensure
ActiveRecord::Base.clear_active_connections!
ActiveRecord::Base.connection.close
end
end

View File

@ -1,8 +1,9 @@
module BuildLists module BuildLists
class BuildCancelingDestroyJob class BuildCancelingDestroyJob < BaseActiveRecordJob
@queue = :low include Sidekiq::Worker
sidekiq_options :queue => :low
def self.perform def perform_with_ar_connection
scope = BuildList.for_status(BuildList::BUILD_CANCELING).for_notified_date_period(nil, 1.hours.ago) scope = BuildList.for_status(BuildList::BUILD_CANCELING).for_notified_date_period(nil, 1.hours.ago)
scope.find_each(batch_size: 50) do |bl| scope.find_each(batch_size: 50) do |bl|

View File

@ -1,10 +1,11 @@
module BuildLists module BuildLists
class CleanBuildrootJob class CleanBuildrootJob < BaseActiveRecordJob
@queue = :middle include Sidekiq::Worker
sidekiq_options :queue => :middle
FILENAME = 'rpm-buildroot.tar.gz' FILENAME = 'rpm-buildroot.tar.gz'
def self.perform def perform_with_ar_connection
build_lists = BuildList.where(save_buildroot: true). build_lists = BuildList.where(save_buildroot: true).
for_status(BuildList::BUILD_ERROR). for_status(BuildList::BUILD_ERROR).
where('updated_at < ?', Time.now - 1.hour). where('updated_at < ?', Time.now - 1.hour).
@ -21,7 +22,9 @@ module BuildLists
end end
end end
def self.clean_file_store(buildroots) private
def clean_file_store(buildroots)
buildroots.each do |r| buildroots.each do |r|
FileStoreService::File.new(sha1: r['sha1']).destroy FileStoreService::File.new(sha1: r['sha1']).destroy
end end

View File

@ -1,11 +1,14 @@
module BuildLists module BuildLists
class ClearBuilderOnStaleBuildListsJob class ClearBuilderOnStaleBuildListsJob < BaseActiveRecordJob
@queue = :low include Sidekiq::Worker
sidekiq_options :queue => :low
def self.perform def perform_with_ar_connection
BuildList.where(["updated_at < ?", 120.seconds.ago]).where(status: BuildList::BUILD_PENDING).find_each(batch_size: 50) do |bl| BuildList.transaction do
bl.builder = nil BuildList.where(["updated_at < ?", 120.seconds.ago]).where(status: BuildList::BUILD_PENDING).where.not(builder: nil).find_each(batch_size: 50) do |bl|
bl.save bl.builder = nil
bl.save
end
end end
end end
end end

View File

@ -1,8 +1,9 @@
module BuildLists module BuildLists
class CreateContainerJob class CreateContainerJob < BaseActiveRecordJob
@queue = :middle include Sidekiq::Worker
sidekiq_options :queue => :middle
def self.perform(build_list_id) def perform_with_ar_connection(build_list_id)
build_list = BuildList.find(build_list_id) build_list = BuildList.find(build_list_id)
container = AbfWorkerService::Container.new(build_list) container = AbfWorkerService::Container.new(build_list)
container.create! container.create!

View File

@ -1,7 +1,7 @@
class CleanApiDefenderStatisticsJob class CleanApiDefenderStatisticsJob
@queue = :low include Sidekiq::Worker
def self.perform def perform
deadline = Date.today - 1.month deadline = Date.today - 1.month
Redis.current.keys.select do |key| Redis.current.keys.select do |key|
next if key !~ /^throttle:/ next if key !~ /^throttle:/

View File

@ -1,7 +1,7 @@
class CleanRpmBuildNodeJob class CleanRpmBuildNodeJob
@queue = :middle include Sidekiq::Worker
def self.perform def perform
RpmBuildNode.all.each do |n| RpmBuildNode.all.each do |n|
n.delete unless n.user_id n.delete unless n.user_id
end end

View File

@ -1,23 +1,21 @@
class CreateEmptyMetadataJob < Struct.new(:class_name, :id) class CreateEmptyMetadataJob < BaseActiveRecordJob
@queue = :low include Sidekiq::Worker
sidekiq_options :queue => :low
def perform def perform_with_ar_connection(class_name, id)
@id = id
case class_name case class_name
when Platform.name when Platform.name
create_empty_metadata_for_platform create_empty_metadata_for_platform
when Repository.name when Repository.name
create_empty_metadata_for_repository Repository.find(id) create_empty_metadata_for_repository Repository.find(@id)
end end
end end
def self.perform(class_name, id)
new(class_name, id).perform
end
private private
def create_empty_metadata_for_platform def create_empty_metadata_for_platform
platform = Platform.main.opened.find id platform = Platform.main.opened.find @id
@platforms = [platform] @platforms = [platform]
repositories = Repository.joins(:platform). repositories = Repository.joins(:platform).
where(platforms: { platform_type: Platform::TYPE_PERSONAL }) where(platforms: { platform_type: Platform::TYPE_PERSONAL })

View File

@ -1,6 +1,10 @@
class DestroyProjectFromRepositoryJob class DestroyProjectFromRepositoryJob < BaseActiveRecordJob
include Sidekiq::Worker
sidekiq_options :queue => :low
def self.perform(project, repository) def perform_with_ar_connection(project_id, repository_id)
project = Project.find(project_id)
repository = Repository.find(repository_id)
service = AbfWorkerService::Repository.new(repository) service = AbfWorkerService::Repository.new(repository)
service.destroy_project!(project) service.destroy_project!(project)
end end

View File

@ -1,11 +1,8 @@
class PublishTaskManagerJob class PublishTaskManagerJob < BaseActiveRecordJob
@queue = :middle include Sidekiq::Worker
sidekiq_options :queue => :middle
def self.perform def perform_with_ar_connection
PublishTaskManagerJob.new.perform
end
def perform
regenerate_metadata_for_software_center regenerate_metadata_for_software_center
resign_repositories resign_repositories
regenerate_metadata regenerate_metadata

View File

@ -1,7 +1,8 @@
class RemoveOutdatedItemsJob class RemoveOutdatedItemsJob < BaseActiveRecordJob
@queue = :low include Sidekiq::Worker
sidekiq_options :queue => :low
def self.perform def perform_with_ar_connection
log_file = Rails.root.join("log", "remove_outdated.log").to_s log_file = Rails.root.join("log", "remove_outdated.log").to_s
counter_bl = 0 counter_bl = 0
BuildList.outdated.find_each(batch_size: 100) do |bl| BuildList.outdated.find_each(batch_size: 100) do |bl|

View File

@ -1,11 +1,8 @@
class RunExtraMassBuildsJob class RunExtraMassBuildsJob < BaseActiveRecordJob
@queue = :low include Sidekiq::Worker
sidekiq_options :queue => :low
def self.perform def perform_with_ar_connection
RunExtraMassBuildsJob.new.perform
end
def perform
MassBuild.where(status: MassBuild::BUILD_PENDING).find_each do |mb| MassBuild.where(status: MassBuild::BUILD_PENDING).find_each do |mb|
next if mb.extra_mass_builds.blank? next if mb.extra_mass_builds.blank?
emb = MassBuild.where(status: MassBuild::SUCCESS, id: mb.extra_mass_builds).to_a emb = MassBuild.where(status: MassBuild::SUCCESS, id: mb.extra_mass_builds).to_a

View File

@ -6,7 +6,7 @@ class FeedbackMailer < ActionMailer::Base
bcc: FBM_CONFIG['bcc'] bcc: FBM_CONFIG['bcc']
default_url_options.merge!(protocol: 'https') if APP_CONFIG['mailer_https_url'] default_url_options.merge!(protocol: 'https') if APP_CONFIG['mailer_https_url']
include Resque::Mailer # send email async # include Resque::Mailer # send email async
def feedback_form_send(form_data) def feedback_form_send(form_data)
@data = Feedback.new(form_data) @data = Feedback.new(form_data)

View File

@ -4,7 +4,7 @@ class UserMailer < ActionMailer::Base
default from: "\"#{APP_CONFIG['project_name']}\" <#{APP_CONFIG['do-not-reply-email']}>" default from: "\"#{APP_CONFIG['project_name']}\" <#{APP_CONFIG['do-not-reply-email']}>"
default_url_options.merge!(protocol: 'https') if APP_CONFIG['mailer_https_url'] default_url_options.merge!(protocol: 'https') if APP_CONFIG['mailer_https_url']
include Resque::Mailer # send email async # include Resque::Mailer # send email async
def build_list_notification(build_list, user) def build_list_notification(build_list, user)
set_locale user set_locale user

View File

@ -169,10 +169,6 @@ class BuildList < ActiveRecord::Base
state_machine :status, initial: :waiting_for_response do state_machine :status, initial: :waiting_for_response do
#after_transition(on: [:place_build, :rerun_tests]) do |build_list, transition|
#build_list.add_job_to_abf_worker_queue if build_list.external_nodes.blank?
#end
after_transition on: :published, after_transition on: :published,
do: %i(set_version_and_tag actualize_packages) do: %i(set_version_and_tag actualize_packages)
after_transition on: :publish, do: :set_publisher after_transition on: :publish, do: :set_publisher
@ -286,7 +282,6 @@ class BuildList < ActiveRecord::Base
end end
later :publish, queue: :middle later :publish, queue: :middle
later :add_job_to_abf_worker_queue, queue: :middle
HUMAN_CONTAINER_STATUSES = { WAITING_FOR_RESPONSE => :waiting_for_publish, HUMAN_CONTAINER_STATUSES = { WAITING_FOR_RESPONSE => :waiting_for_publish,
BUILD_PUBLISHED => :container_published, BUILD_PUBLISHED => :container_published,
@ -571,7 +566,7 @@ class BuildList < ActiveRecord::Base
protected protected
def create_container def create_container
Resque.enqueue(BuildLists::CreateContainerJob, id) BuildLists::CreateContainerJob.perform_async(id)
end end
def remove_container def remove_container
@ -595,14 +590,14 @@ class BuildList < ActiveRecord::Base
end end
def notify_users def notify_users
unless mass_build_id #unless mass_build_id
users = [user, publisher].compact.uniq.select{ |u| u.notifier.can_notify? && u.notifier.new_build? } # users = [user, publisher].compact.uniq.select{ |u| u.notifier.can_notify? && u.notifier.new_build? }
users |= project.all_members(:notifier).select do |u| # users |= project.all_members(:notifier).select do |u|
u.notifier.can_notify? && u.notifier.new_associated_build? # u.notifier.can_notify? && u.notifier.new_associated_build?
end if project # end if project
users.each{ |u| UserMailer.build_list_notification(self, u).deliver } # users.each{ |u| UserMailer.build_list_notification(self, u).deliver }
end #end
end # notify_users end # notify_users
def build_package(pkg_hash, package_type, prj) def build_package(pkg_hash, package_type, prj)

View File

@ -22,8 +22,8 @@ module AbfWorkerMethods
end end
def add_job_to_abf_worker_queue def add_job_to_abf_worker_queue
Resque.push( Sidekiq::Client.push(
worker_queue_with_priority, 'queue' => worker_queue_with_priority,
'class' => worker_queue_class, 'class' => worker_queue_class,
'args' => [abf_worker_args] 'args' => [abf_worker_args]
) )
@ -39,11 +39,8 @@ module AbfWorkerMethods
end end
def destroy_from_resque_queue def destroy_from_resque_queue
Resque::Job.destroy( #FIX THIS
worker_queue_with_priority, 0
worker_queue_class,
abf_worker_args
)
end end
def worker_queue_with_priority(prefix = true) def worker_queue_with_priority(prefix = true)

View File

@ -7,7 +7,7 @@ module EmptyMetadata
def create_empty_metadata def create_empty_metadata
return if is_a?(Platform) && ( personal? || hidden? ) return if is_a?(Platform) && ( personal? || hidden? )
Resque.enqueue(CreateEmptyMetadataJob, self.class.name, id) CreateEmptyMetadataJob.perform_async(self.class.name, id)
end end
end end

View File

@ -310,8 +310,8 @@ class Platform < ActiveRecord::Base
end end
def notify_users def notify_users
users = members.includes(:notifier).select{ |u| u.notifier.can_notify? } #users = members.includes(:notifier).select{ |u| u.notifier.can_notify? }
users.each{ |u| UserMailer.metadata_regeneration_notification(self, u).deliver } #users.each{ |u| UserMailer.metadata_regeneration_notification(self, u).deliver }
end end
end end

View File

@ -27,7 +27,7 @@ class ProjectToRepository < ActiveRecord::Base
protected protected
def destroy_project_from_repository def destroy_project_from_repository
DestroyProjectFromRepositoryJob.perform(project, repository) DestroyProjectFromRepositoryJob.perform_async(project_id, repository_id)
end end
def one_project_in_platform_repositories def one_project_in_platform_repositories

View File

@ -38,10 +38,10 @@ class AbfWorkerStatusPresenter
def get_status(*queues) def get_status(*queues)
status = {} status = {}
queues.each do |worker| #queues.each do |worker|
workers = Resque.workers.select{ |w| yield w, worker } # workers = Resque.workers.select{ |w| yield w, worker }
status[worker] = status_of_worker workers, worker # status[worker] = status_of_worker workers, worker
end #end
status status
end end

View File

@ -15,8 +15,8 @@ module AbfWorkerService
return return
end end
Resque.push( Sidekiq::Client.push(
'publish_worker', # Low priority 'queue' => 'publish_worker', # Low priority
'class' => 'AbfWorker::PublishWorker', 'class' => 'AbfWorker::PublishWorker',
'args' => [{ 'args' => [{
id: build_list.id, id: build_list.id,

View File

@ -10,8 +10,8 @@ module AbfWorkerService
def regenerate! def regenerate!
return unless can_regenerate? return unless can_regenerate?
Resque.push( Sidekiq::Client.push(
'publish_worker_default', 'queue' => 'publish_worker_default',
'class' => 'AbfWorker::PublishWorkerDefault', 'class' => 'AbfWorker::PublishWorkerDefault',
'args' => [{ 'args' => [{
id: Time.now.to_i, id: Time.now.to_i,

View File

@ -30,8 +30,8 @@ module AbfWorkerService
def resign!(repository_status) def resign!(repository_status)
return if repository.repo_lock_file_exists? return if repository.repo_lock_file_exists?
Resque.push( Sidekiq::Client.push(
'publish_worker_default', 'queue' => 'publish_worker_default',
'class' => "AbfWorker::PublishWorkerDefault", 'class' => "AbfWorker::PublishWorkerDefault",
'args' => [{ 'args' => [{
id: repository.id, id: repository.id,

View File

@ -18,8 +18,8 @@ module AbfWorkerService
system "mkdir -p #{platform_path}" system "mkdir -p #{platform_path}"
end end
Resque.push( Sidekiq::Client.push(
'publish_worker_default', 'queue' => 'publish_worker_default',
'class' => 'AbfWorker::PublishWorkerDefault', 'class' => 'AbfWorker::PublishWorkerDefault',
'args' => [{ 'args' => [{
id: Time.now.to_i, id: Time.now.to_i,

View File

@ -206,8 +206,8 @@ module AbfWorkerService
end end
def push(options) def push(options)
Resque.push( Sidekiq::Client.push(
'publish_worker_default', 'queue' => 'publish_worker_default',
'class' => 'AbfWorker::PublishWorkerDefault', 'class' => 'AbfWorker::PublishWorkerDefault',
'args' => [options] 'args' => [options]
) )

View File

@ -1,2 +0,0 @@
div ng-if="false"

View File

@ -9,50 +9,37 @@ html
= auto_discovery_link_tag :atom, atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token), title: t("layout.atom_link_tag_title", nickname: current_user.uname, app_name: APP_CONFIG['project_name']) = auto_discovery_link_tag :atom, atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token), title: t("layout.atom_link_tag_title", nickname: current_user.uname, app_name: APP_CONFIG['project_name'])
script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.js" type="text/javascript" script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.js" type="text/javascript"
link href='//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' rel='stylesheet' link href='//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' rel='stylesheet'
link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"
link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css' link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'
== stylesheet_link_tag 'new_application', cache: 'application' == stylesheet_link_tag 'new_application', cache: 'application'
body[ ng-app='RosaABF' ng-controller='RosaABFController' ng-strict-di='' body[ ng-app='RosaABF' ng-controller='RosaABFController' ng-strict-di=''
ng-init="init('#{I18n.locale}', #{!!current_user.try(:sound_notifications)})" ng-cloak="true"] ng-init="init('#{I18n.locale}', #{!!current_user.try(:sound_notifications)})" ng-cloak="true"]
.page-wrapper.open .page-wrapper ng-class="{'open': toggle}"
.sidebar-wrapper .sidebar-wrapper
ul.sidebar ul.sidebar
li.sidebar-main li.sidebar-main
a href="/" a ng-click="toggleSidebar()"
= link_to image_tag('logo-mini.png', alt: 'ABF'), root_path = image_tag('logo-mini.png', alt: 'ABF')
span class="menu-icon glyphicon glyphicon-transfer"
== render 'layouts/menu/new_top' == render 'layouts/menu/new_top'
== render 'layouts/menu/new_bottom'
.content-wrapper .content-wrapper
.page-content .page-content
.row.header
.col-md-12
.user.pull-right
- if current_user
.item.dropdown(uib-dropdown)
a(uib-dropdown-toggle)
= image_tag avatar_url(current_user), alt: 'avatar'
ul.dropdown-menu.dropdown-menu-right
li.link= link_to current_user.uname, current_user
li.link= link_to t('layout.settings.label'), profile_settings_path
li.divider
li.link= link_to t('layout.logout'), destroy_user_session_path, method: :delete
- else
ul.nav.navbar-nav
li= link_to t('layout.devise.shared_links.sign_up'), new_user_registration_path
li= link_to t('layout.devise.shared_links.sign_in'), new_user_session_path
.meta
.page
== yield :submenu if content_for?(:submenu) == yield :submenu if content_for?(:submenu)
== render 'layouts/noscript' == render 'layouts/noscript'
== render "layouts/flashes" == render "layouts/flashes"
== yield == yield
script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js" type="text/javascript"
script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment.min.js" type="text/javascript" script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment.min.js" type="text/javascript"
script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-resource.js" type="text/javascript" script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-resource.min.js" type="text/javascript"
script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-cookies.js" type="text/javascript" script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-cookies.min.js" type="text/javascript"
script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-sanitize.js" type="text/javascript" script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-sanitize.min.js" type="text/javascript"
script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.2.5/ui-bootstrap-tpls.js" type="text/javascript" script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.2.5/ui-bootstrap-tpls.min.js" type="text/javascript"
script src="https://code.jquery.com/jquery-2.2.2.min.js" integrity="sha256-36cp2Co+/62rEAAYHLmRCPIych47CvdM+uTBJwSzWjI=" crossorigin="anonymous" script src="https://code.jquery.com/jquery-2.2.2.min.js" integrity="sha256-36cp2Co+/62rEAAYHLmRCPIych47CvdM+uTBJwSzWjI=" crossorigin="anonymous"
== javascript_include_tag 'new_application', cache: 'application' == javascript_include_tag 'new_application', cache: 'application'
== yield :additional_scripts if content_for?(:additional_scripts) == yield :additional_scripts if content_for?(:additional_scripts)

View File

@ -7,118 +7,119 @@
- product = pbl.product - product = pbl.product
- platform = product.platform - platform = product.platform
.row ng-controller='ProductBuildListController' ng-init=("init("+pbl.id.to_s+")") div ng-init=("init("+pbl.id.to_s+")") ng-controller='ProductBuildListController'
.col-md-6 .row
rd-widget .col-md-6
rd-widget-header title=t('layout.product_build_lists.main_data') rd-widget
rd-widget-body class="no-padding" rd-widget-header title=t('layout.product_build_lists.main_data')
table.table.table-condensed rd-widget-body class="no-padding"
tr table.table.table-condensed
td tr
= t('activerecord.attributes.product_build_list.id') td
td = t('activerecord.attributes.product_build_list.id')
= pbl.id td
= pbl.id
tr tr
td td
= t('activerecord.attributes.product_build_list.status') = t('activerecord.attributes.product_build_list.status')
td td
| {{pbl.human_status}} | {{pbl.human_status}}
- if pbl.user - if pbl.user
tr tr
td td
= t('activerecord.attributes.product_build_list.user') = t('activerecord.attributes.product_build_list.user')
td td
= link_to pbl.user.try(:fullname), pbl.user = link_to pbl.user.try(:fullname), pbl.user
tr
td
= t('activerecord.attributes.product_build_list.product')
td
= link_to pbl.product.name, platform_product_path(platform, product)
tr tr
td td
= t('activerecord.attributes.product_build_list.product') = t('activerecord.attributes.product_build_list.project')
td td
= link_to pbl.product.name, platform_product_path(platform, product) = link_to pbl.project.name_with_owner, project_build_lists_path(pbl.project)
tr tr
td
= t('activerecord.attributes.product_build_list.project')
td
= link_to pbl.project.name_with_owner, project_build_lists_path(pbl.project)
tr
td
= t('activerecord.attributes.product_build_list.project_version')
td
= product_build_list_version_link(pbl, true)
tr
td
= t('activerecord.attributes.product_build_list.main_script')
td
= pbl.main_script
tr
td
= t('activerecord.attributes.product_build_list.params')
td
= pbl.params
tr
td
= t('activerecord.attributes.product_build_list.time_living')
td
= pbl.time_living / 60
tr
td
= t('activerecord.attributes.product_build_list.autostarted')
td
= t("layout.#{pbl.autostarted}_")
tr
td
= t('activerecord.attributes.product_build_list.notified_at')
td
| {{pbl.notified_at}}
- if policy(pbl).update?
tr ng-show="pbl.status == #{ ProductBuildList::BUILD_COMPLETED }"
td td
= t('activerecord.attributes.product_build_list.not_delete') = t('activerecord.attributes.product_build_list.project_version')
td td
= select_tag 'not_delete', = product_build_list_version_link(pbl, true)
options_for_select(product_build_list_delete_options),
{ ng_model: "pbl.not_delete", ng_change: 'updateStatus()'}
.row.alert.alert-danger.top-space ng-hide='pbl.not_delete != "false"'
- days = pbl.autostarted? ? ProductBuildList::LIVE_TIME : ProductBuildList::MAX_LIVE_TIME
- days = (pbl.created_at.to_date - days.ago.to_date).to_i
- if days > 1
= t('layout.product_build_lists.will_be_removed_n_days', n: days)
- else
= t('layout.product_build_lists.will_be_removed_today')
- if policy(pbl).cancel? || policy(pbl).destroy? tr
rd-widget-footer ng-show="pbl.can_cancel || pbl.can_destroy" td
- if policy(pbl).cancel? = t('activerecord.attributes.product_build_list.main_script')
a.btn.btn-warning[ td
href=cancel_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) = pbl.main_script
data-method = 'put'
data-confirm = t('layout.confirm')
ng-show = 'pbl.can_cancel' ]
= t('layout.build_lists.cancel')
| &nbsp;
- if policy(pbl).destroy? tr
a.btn.btn-danger[ td
href=platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) = t('activerecord.attributes.product_build_list.params')
data-method = 'delete' td
data-confirm = t('layout.confirm') = pbl.params
ng-show = 'pbl.can_destroy' ]
= t('layout.product_build_lists.delete')
.col-md-6
= render 'shared/build_results', subject: pbl
.row ng-show="pbl.status == #{ProductBuildList::BUILD_STARTED}" tr
.col-md-12 td
= render 'shared/log', { build_started: true, get_log_path: log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) } = t('activerecord.attributes.product_build_list.time_living')
td
= pbl.time_living / 60
tr
td
= t('activerecord.attributes.product_build_list.autostarted')
td
= t("layout.#{pbl.autostarted}_")
tr
td
= t('activerecord.attributes.product_build_list.notified_at')
td
| {{pbl.notified_at}}
- if policy(pbl).update?
tr ng-show="pbl.status == #{ ProductBuildList::BUILD_COMPLETED }"
td
= t('activerecord.attributes.product_build_list.not_delete')
td
= select_tag 'not_delete',
options_for_select(product_build_list_delete_options),
{ ng_model: "pbl.not_delete", ng_change: 'updateStatus()'}
.row.alert.alert-danger.top-space ng-hide='pbl.not_delete != "false"'
- days = pbl.autostarted? ? ProductBuildList::LIVE_TIME : ProductBuildList::MAX_LIVE_TIME
- days = (pbl.created_at.to_date - days.ago.to_date).to_i
- if days > 1
= t('layout.product_build_lists.will_be_removed_n_days', n: days)
- else
= t('layout.product_build_lists.will_be_removed_today')
- if policy(pbl).cancel? || policy(pbl).destroy?
rd-widget-footer ng-show="pbl.can_cancel || pbl.can_destroy"
- if policy(pbl).cancel?
a.btn.btn-warning[
href=cancel_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl)
data-method = 'put'
data-confirm = t('layout.confirm')
ng-show = 'pbl.can_cancel' ]
= t('layout.build_lists.cancel')
| &nbsp;
- if policy(pbl).destroy?
a.btn.btn-danger[
href=platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl)
data-method = 'delete'
data-confirm = t('layout.confirm')
ng-show = 'pbl.can_destroy' ]
= t('layout.product_build_lists.delete')
.col-md-6
= render 'shared/build_results', subject: pbl
.row.top-space ng-show="pbl.status == #{ProductBuildList::BUILD_STARTED}"
.col-md-12
= render 'shared/log', { build_started: true, get_log_path: log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) }

View File

@ -1,15 +1,15 @@
require 'resque/server' #require 'resque/server'
require 'resque/status_server' #require 'resque/status_server'
require 'resque_scheduler' #require 'resque_scheduler'
require 'resque_scheduler/server' #require 'resque_scheduler/server'
::ResqueServer = ::Resque::Server # need for CanCan #::ResqueServer = ::Resque::Server # need for CanCan
Resque::Mailer.default_queue_name = :notification #Resque::Mailer.default_queue_name = :notification
Resque::Mailer.excluded_environments = [:test] #Resque::Mailer.excluded_environments = [:test]
unless Rails.env.test? #unless Rails.env.test?
PerformLater.config.enabled = true # this will default to false if unset # PerformLater.config.enabled = true # this will default to false if unset
end #end
Resque::Plugins::Status::Hash.expire_in = (24 * 60 * 60) # 24hrs in seconds #Resque::Plugins::Status::Hash.expire_in = (24 * 60 * 60) # 24hrs in seconds

View File

@ -0,0 +1,11 @@
require 'sidekiq/scheduler'
Kiqit.config.enabled = true
Sidekiq.configure_server do |config|
config.on(:startup) do
Sidekiq.schedule = YAML
.load_file(File.expand_path('../../../config/schedule.yml', __FILE__))
Sidekiq::Scheduler.reload_schedule!
end
end

View File

@ -1,3 +1,6 @@
require 'sidekiq/web'
require 'sidekiq-scheduler/web'
Rails.application.routes.draw do Rails.application.routes.draw do
# ActiveAdmin routes. # ActiveAdmin routes.
@ -5,7 +8,7 @@ Rails.application.routes.draw do
namespace :admin do namespace :admin do
constraints Rosa::Constraints::AdminAccess do constraints Rosa::Constraints::AdminAccess do
mount Resque::Server => 'resque' mount Sidekiq::Web => 'sidekiq'
end end
end end

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 KiB

View File

@ -1,23 +0,0 @@
namespace :resque do
desc 'Stop all Resque workers'
task stop_workers: :environment do
pids = []
Resque.workers.each do |worker|
pids << worker.to_s.split(/:/).second
end
system("kill -QUIT #{pids.join(' ')}") if pids.size > 0
end
# This fixes connection fail with Postgres server on new fork:
task setup: :environment do
Resque.after_fork do
Resque.redis.client.reconnect
end
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
end
task scheduler_setup: :environment do
Resque.schedule = YAML.load_file(Rails.root.join('config', 'resque_schedule.yml'))
end
end