Merge branch 'next-minor' into develop

This commit is contained in:
Benjamin Neff 2018-04-16 01:26:56 +02:00
commit d5f5e1991b
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
8 changed files with 80 additions and 129 deletions

1
.gitignore vendored
View file

@ -16,6 +16,7 @@ vendor/bundle/
vendor/cache/
config/database.yml
config/oidc_key.pem
config/schedule.yml
# Generated files
log/

View file

@ -14,6 +14,7 @@
## Refactor
* Remove the 'make contacts in this aspect visible to each other' option [#7769](https://github.com/diaspora/diaspora/pull/7769)
* Remove the requirement to have at least two users to disable the /podmin redirect [#7783](https://github.com/diaspora/diaspora/pull/7783)
* Randomize start times of daily Sidekiq-Cron jobs [#7787](https://github.com/diaspora/diaspora/pull/7787)
## Bug fixes
* Prefill conversation form on contacts page only with mutual contacts [#7744](https://github.com/diaspora/diaspora/pull/7744)

View file

@ -17,7 +17,6 @@
@import 'interactions';
@import 'spinner';
@import 'timeago';
@import 'vendor/fileuploader';
@import 'vendor/autoSuggest';
@import 'typeahead';
@import 'colors';

View file

@ -1,74 +0,0 @@
.qq-uploader {
position:relative;
width: 100%;
}
.qq-upload-button {
display:block; /* or inline-block */
width: 105px;
padding: 7px 0;
text-align:center;
background:#333;
border-bottom:1px solid #999;
color:#fff;
}
.qq-upload-drop-area {
position:absolute;
top:0; left:0;
width:100%;
height:100%;
min-height: 70px;
z-index:2;
background:#ccc;
text-align:center;
}
.qq-upload-drop-area span {
display:block;
position:absolute;
top: 50%;
width:100%;
margin-top:-8px;
font-size:16px;
}
.qq-upload-drop-area-active {
background:#FF7171;
}
.qq-upload-list {
margin:15px 35px;
padding:0;
list-style:disc;
}
.qq-upload-list li {
margin:0;
padding:0;
line-height:15px;
font-size:12px;
}
.qq-upload-file, .qq-upload-spinner, .qq-upload-size, .qq-upload-cancel, .qq-upload-failed-text {
margin-right: 7px;
}
.qq-upload-spinner {
display:inline-block;
background: url("loading.gif");
width:15px;
height:15px;
vertical-align:text-bottom;
}
.qq-upload-size,.qq-upload-cancel {
font-size:11px;
}
.qq-upload-failed-text {
display:none;
}
.qq-upload-fail .qq-upload-failed-text {
display:inline;
}

View file

@ -54,9 +54,3 @@ end
Sidekiq.configure_client do |config|
config.redis = AppConfig.get_redis_options
end
schedule_file = "config/schedule.yml"
if File.exist?(schedule_file) && Sidekiq.server?
Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file)
end

View file

@ -0,0 +1,78 @@
# frozen_string_literal: true
# Some recurring background jobs can take a lot of resources, and others even
# include pinging other pods, like recurring_pod_check. Having all jobs run at
# 0 UTC causes a high local load, as well as a little bit of DDoSing through
# the network, as pods try to ping each other.
#
# As Sidekiq-Cron does not support random offsets, we have to take care of that
# ourselves, so let's add jobs with random work times.
# rubocop:disable Metrics/MethodLength
def default_job_config
random_hour = lambda { rand(24) }
random_minute = lambda { rand(60) }
{
check_birthday: {
"cron": "0 0 * * *",
"class": "Workers::CheckBirthday"
},
clean_cached_files: {
"cron": "#{random_minute.call} #{random_hour.call} * * *",
"class": "Workers::CleanCachedFiles"
},
cleanup_old_exports: {
"cron": "#{random_minute.call} #{random_hour.call} * * *",
"class": "Workers::CleanupOldExports"
},
queue_users_for_removal: {
"cron": "#{random_minute.call} #{random_hour.call} * * *",
"class": "Workers::QueueUsersForRemoval"
},
recheck_scheduled_pods: {
"cron": "*/30 * * * *",
"class": "Workers::RecheckScheduledPods"
},
recurring_pod_check: {
"cron": "#{random_minute.call} #{random_hour.call} * * *",
"class": "Workers::RecurringPodCheck"
}
}
end
# rubocop:enable Metrics/MethodLength
def valid_config?(path)
return false unless File.exist?(path)
current_config = YAML.load_file(path)
# If they key don't match the current default config keys, a new job has
# been added, so we nede to regenerate the config to have the new job
# running
return false unless current_config.keys == default_job_config.keys
# If recurring_pod_check is still running at midnight UTC, the config file
# is probably from a previous version, and that's bad, so we need to
# regenerate
current_config[:recurring_pod_check][:cron] != "0 0 * * *"
end
def regenerate_config(path)
job_config = default_job_config
File.open(path, "w") do |schedule_file|
schedule_file.write(job_config.to_yaml)
end
end
if Sidekiq.server?
schedule_file_path = Rails.root.join("config", "schedule.yml")
regenerate_config(schedule_file_path) unless valid_config?(schedule_file_path)
Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file_path)
end

View file

@ -1,25 +0,0 @@
# Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# set :environment, "production"
# Example:
set :output, File.join( File.dirname( __FILE__ ), '..', 'logs', 'scheduled_tasks.log' )
every 1.day, :at => '3:00 am' do
rake 'maintenance:clear_carrierwave_temp_uploads'
end
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_method"
# rake "some:great:rake:task"
# end
#
# every 4.days do
# runner "AnotherModel.prune_old_records"
# end
# Learn more: http://github.com/javan/whenever

View file

@ -1,23 +0,0 @@
clean_cached_files:
cron: "0 0 * * *"
class: "Workers::CleanCachedFiles"
queue_users_for_removal:
cron: "0 0 * * *"
class: "Workers::QueueUsersForRemoval"
recurring_pod_check:
cron: "0 0 * * *"
class: "Workers::RecurringPodCheck"
recheck_scheduled_pods:
cron: "*/30 * * * *"
class: "Workers::RecheckScheduledPods"
check_birthday:
cron: "0 0 * * *"
class: "Workers::CheckBirthday"
cleanup_old_exports:
cron: "0 0 * * *"
class: "Workers::CleanupOldExports"