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
#it retries only if Timeout is present | |
module HookTimeoutRetry | |
def on_failure_retry(e, *args) | |
key = "AutoRetry:#{self.name}:#{Digest::MD5.hexdigest(Resque.encode(args))}" | |
counter = Resque.redis.incr(key) | |
Resque.redis.expire(key, 180) | |
if [Timeout::Error, Redis::TimeoutError].include?(e.class) && counter <= 3 | |
Rails.logger.info "Performing #{self} caused an exception (#{e}). Retrying..." | |
Resque.enqueue self, *args |
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
#!/bin/bash | |
MASTER_PID=`cat /home/deploy/app/shared/sockets/puma.state | grep pid | awk '{print $2}'` | |
PIDS=`ps auxwww | grep -v $MASTER_PID | grep [p]uma | awk '{print $2}'` | |
MAX_MEMORY=500000000 | |
for pid in $PIDS | |
do | |
MEM_USAGE=`ls -l /proc/$pid/as | awk '{print $5}'` | |
if [ $MEM_USAGE -gt $MAX_MEMORY ] | |
then | |
echo "Memory $MEM_USAGE exceeded $MAX_MEMORY killing $pid" |
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
config.action_controller.asset_host = proc do |source| | |
if source =~ /(ttf|ttc|otf|eot|woff|svg)$/ | |
"https://www.domain.com" | |
else | |
"https://cdn#{Digest::MD5.hexdigest(source).to_i(16) % 4 }.domain.com" | |
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
#lib/spree/api/responders_decorator.rb | |
Spree::Api::Responders::AppResponder.class_eval do | |
def template | |
options[:default_template] | |
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
require 'github_api' | |
require 'git' | |
client = Github.new oauth_token: 'TOKEN', org: 'ORG_NAME' | |
BASE_DIR ||= '../repos' | |
i = 1 | |
while true | |
repos = client.repos.list(page: i) |
OlderNewer