Mailinglist Archive: opensuse-buildservice (238 mails)

< Previous Next >
[opensuse-buildservice] frontend does too much when uploading a file
  • From: Marcus Hüwe <suse-tux@xxxxxx>
  • Date: Fri, 30 May 2008 15:11:31 +0200
  • Message-id: <20080530131130.GA3692@xxxxxxxxxxxxxxxxxxx>

during a file upload the frontend performs superfluous (IMHO) tasks like
sending the package metadata (which doesn't change during the upload) to
the backend etc.
The problematic method is "update_timestamp" in the Package() class (see
models/package.rb). Instead of simply updating some timestamp tables it
regenerates the complete metadata.
I attached a small patch which _only_ updates the timestamp without touching
any metadata.
Btw. with this patch we gain a small perfomance boost:
- executing the old version takes around 2.81 seconds
- executing the new version takes around 1 second
(measured with ruby's 'profiler' module)


Ps. I don't know if this is a good "ruby style" but it works for me:)
Index: app/models/package.rb
--- app/models/package.rb (Revision 4060)
+++ app/models/package.rb (Arbeitskopie)
@@ -31,9 +31,13 @@

def update_timestamp
- # save will call DbPackage.store_axml() through
- # which will do DbPackage.update_timestamp() and
- save
+ require 'db_package'
+ DbPackage.transaction do
+ db_pac = DbPackage.find_by_project_and_name self.parent_project_name,
+ raise "project \"#{self.parent_project_name}\" or package
\"#{}\" not found" unless db_pac
+ db_pac.update_timestamp
+ end

< Previous Next >
Follow Ups