[refs #570] Remove mass build counters logs and transactions
This commit is contained in:
parent
548fb99ebe
commit
33e6cdc285
|
@ -9,7 +9,6 @@ class BuildList < ActiveRecord::Base
|
|||
belongs_to :mass_build, :counter_cache => true
|
||||
has_many :items, :class_name => "BuildList::Item", :dependent => :destroy
|
||||
has_many :packages, :class_name => "BuildList::Package", :dependent => :destroy
|
||||
has_many :counters_logs, :dependent => :destroy
|
||||
|
||||
UPDATE_TYPES = %w[security bugfix enhancement recommended newpackage]
|
||||
RELEASE_UPDATE_TYPES = %w[security bugfix]
|
||||
|
@ -101,8 +100,6 @@ class BuildList < ActiveRecord::Base
|
|||
after_commit :place_build
|
||||
after_destroy :delete_container
|
||||
|
||||
after_create lambda { |build_list| build_list.counters_logs.create(:status => build_list.status, :event => "create", :mass_build_id => build_list.mass_build_id) }
|
||||
|
||||
@queue = :clone_and_build
|
||||
|
||||
state_machine :status, :initial => :waiting_for_response do
|
||||
|
@ -110,21 +107,13 @@ class BuildList < ActiveRecord::Base
|
|||
# WTF? around_transition -> infinite loop
|
||||
before_transition do |build_list, transition|
|
||||
if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(BuildList::HUMAN_STATUSES[build_list.status])
|
||||
#MassBuild.decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
||||
MassBuild.transaction do
|
||||
MassBuild.lock(true).decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
||||
end
|
||||
build_list.counters_logs.create(:status => build_list.status, :event => "decrement", :mass_build_id => build_list.mass_build_id)
|
||||
MassBuild.decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
||||
end
|
||||
end
|
||||
|
||||
after_transition do |build_list, transition|
|
||||
if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(BuildList::HUMAN_STATUSES[build_list.status])
|
||||
#MassBuild.increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
||||
MassBuild.transaction do
|
||||
MassBuild.lock(true).increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
||||
end
|
||||
build_list.counters_logs.create(:status => build_list.status, :event => "increment", :mass_build_id => build_list.mass_build_id)
|
||||
MassBuild.increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
class CountersLog < ActiveRecord::Base
|
||||
belongs_to :build_list
|
||||
belongs_to :mass_build
|
||||
end
|
|
@ -2,7 +2,6 @@ class MassBuild < ActiveRecord::Base
|
|||
belongs_to :platform
|
||||
belongs_to :user
|
||||
has_many :build_lists, :dependent => :destroy
|
||||
has_many :counters_logs, :dependent => :destroy
|
||||
|
||||
scope :by_platform, lambda { |platform| where(:platform_id => platform.id) }
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
class CreateCountersLogs < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :counters_logs do |t|
|
||||
t.integer :mass_build_id
|
||||
t.integer :build_list_id
|
||||
t.string :status
|
||||
t.string :event
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
11
db/schema.rb
11
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120726110848) do
|
||||
ActiveRecord::Schema.define(:version => 20120719045806) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -143,15 +143,6 @@ ActiveRecord::Schema.define(:version => 20120726110848) do
|
|||
t.integer "project_id"
|
||||
end
|
||||
|
||||
create_table "counters_logs", :force => true do |t|
|
||||
t.integer "mass_build_id"
|
||||
t.integer "build_list_id"
|
||||
t.string "status"
|
||||
t.string "event"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "event_logs", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.string "user_name"
|
||||
|
|
Loading…
Reference in New Issue