This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# we should set the locale before the migration | |
task 'set_locale' do | |
begin | |
I18n.locale = (SiteSetting.default_locale || :en) rescue :en | |
rescue I18n::InvalidLocale | |
I18n.locale = :en | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# we should set the locale before the migration | |
task 'set_locale' do | |
begin | |
I18n.locale = (SiteSetting.default_locale || :en) rescue :en | |
rescue I18n::InvalidLocale | |
I18n.locale = :en | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# we should set the locale before the migration | |
task 'set_locale' do | |
begin | |
I18n.locale = (SiteSetting.default_locale || :en) rescue :en | |
rescue I18n::InvalidLocale | |
I18n.locale = :en | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# we should set the locale before the migration | |
task 'set_locale' do | |
begin | |
I18n.locale = (SiteSetting.default_locale || :en) rescue :en | |
rescue I18n::InvalidLocale | |
I18n.locale = :en | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class MoveNewSinceToNewTable < ActiveRecord::Migration[6.0] | |
disable_ddl_transaction! | |
BATCH_SIZE = 30_000 | |
def up | |
offset = 0 | |
loop do | |
min_id, max_id = DB.query_single(<<~SQL, offset: offset, batch_size: BATCH_SIZE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[RUBY_DEBUG_COUNTER] 219762 show_debug_counters | |
[RUBY_DEBUG_COUNTER] mc_inline_hit 412,725 | |
[RUBY_DEBUG_COUNTER] mc_inline_miss_klass 39,736 | |
[RUBY_DEBUG_COUNTER] mc_inline_miss_invalidated 0 | |
[RUBY_DEBUG_COUNTER] mc_inline_miss_empty 3,694 | |
[RUBY_DEBUG_COUNTER] mc_inline_miss_same_cc 0 | |
[RUBY_DEBUG_COUNTER] mc_inline_miss_same_cme 28,893 | |
[RUBY_DEBUG_COUNTER] mc_inline_miss_same_def 352 | |
[RUBY_DEBUG_COUNTER] mc_inline_miss_diff 6,797 | |
[RUBY_DEBUG_COUNTER] mc_cme_complement 166 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sam@arch discourse % script/test_page | |
[RUBY_DEBUG_COUNTER] 100909 show_debug_counters | |
[RUBY_DEBUG_COUNTER] mc_inline_hit 412,834 | |
[RUBY_DEBUG_COUNTER] mc_inline_miss_klass 39,745 | |
[RUBY_DEBUG_COUNTER] mc_inline_miss_invalidated 0 | |
[RUBY_DEBUG_COUNTER] mc_cme_complement 166 | |
[RUBY_DEBUG_COUNTER] mc_cme_complement_hit 166 | |
[RUBY_DEBUG_COUNTER] mc_search 4,730 | |
[RUBY_DEBUG_COUNTER] mc_search_notfound 1,638 | |
[RUBY_DEBUG_COUNTER] mc_search_super 69,250 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98c9120cc00ba691b4abcc13a49a30fa54638535 | |
--- | |
categories: | |
50: 34 | |
75: 35 | |
90: 36 | |
99: 40 | |
home: | |
50: 47 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipes are used for signalling ... there is reader and writer | |
# you can send data to the reader by writing to the writer | |
# safe for multithreaded use | |
$r,$w = IO.pipe | |
Thread.new do | |
# change value to 4 to demo how timeout of 3 seconds is reached | |
sleep 2 | |
$w.write_nonblock("early_stop") | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# This runbook is used to debug and correct situations where uploads are missing from | |
# S3. | |
# | |
# It will prompt you to delete missing uploads if any are found. | |
# | |
# Be careful, the actions it takes are destructive, BUT you will have to approve them | |
# for them to happen |