Decoding 1,000 times from small.json (13.3 KB)
user | system | total | real | |
---|---|---|---|---|
Yajl::Parser | 0.240000 | 0.010000 | 0.250000 | ( 0.250759) |
ActiveSupport::JSON | 0.230000 | 0.000000 | 0.230000 | ( 0.229365) |
We have choosed 5 possible options that can be possible to implement.
No more Event classes, no table needed in the database for storing Event's data. We will store the data needed inside the DelayedJob payload (doesn’t mean that the event data is stored as right now, just the data needed). Whenever the event happen jobs are created accordingly to:
Everything stays as it is and we make sure each class of job runs in its own queue and never concurrently
As we agreed for this option on to not run the same job concurrently... to have at most one job enqueued is something we may introduce. Could be something like this in every place we create and enque a job:
JobClass.perform_later if Delayed::Job.where(queue: JobClass.queue_as).count.zero?
# this is to speed up secure Project.find | |
def self.forbidden_project_ids | |
# Admins don't have forbidden projects | |
return [0] if User.current && User.current.is_admin? | |
# This will cache and return an array: | |
# {projecs: [p1,p2], whitelist: { u1: [p1], u2: [p1,p2], u3: [p2] } } | |
forbidden_projects = Rails.cache.fetch('forbidden_projects') do | |
forbidden_projects_hash = {projects: [], whitelist: {}} |
# Update this methods in the Project class | |
class Project | |
def is_remote? | |
false | |
end | |
# returns an object of project(local or remote) or raises an exception | |
def self.get_by_name(project_name, options = {}) | |
project = find_by(name: project_name) |
def get_build_flags(flag_type) | |
the_flags = {} | |
all_repositories = [nil].concat(main_object.repositories.map{|repo| repo.name}) | |
all_architecture = [nil].concat(main_object.architectures) | |
all_repositories.each do |repository| | |
the_flags[repository] = [] | |
all_architectures.each do |architecture| | |
architecture_id = architecture ? architecture.id : nil | |
flag = main_object.flags.with_repositories(repository).with_architectures(architecture_id).first | |
unless flag |