f1ae1e39ce
Moving the check out of the general requests, makes sure we don't have any slowdown in the regular requests. To keep the process performing this checks small, the check is still performed inside a unicorn. But that is called from a process running on the same server. Because the checks are now done outside normal request, we can have a simpler failure strategy: The check is now performed in the background every `circuitbreaker_check_interval`. Failures are logged in redis. The failures are reset when the check succeeds. Per check we will try `circuitbreaker_access_retries` times within `circuitbreaker_storage_timeout` seconds. When the number of failures exceeds `circuitbreaker_failure_count_threshold`, we will block access to the storage. After `failure_reset_time` of no checks, we will clear the stored failures. This could happen when the process that performs the checks is not running.
105 lines
2.5 KiB
Ruby
105 lines
2.5 KiB
Ruby
require 'sidekiq/web'
|
|
require 'sidekiq/cron/web'
|
|
|
|
Rails.application.routes.draw do
|
|
concern :access_requestable do
|
|
post :request_access, on: :collection
|
|
post :approve_access_request, on: :member
|
|
end
|
|
|
|
concern :awardable do
|
|
post :toggle_award_emoji, on: :member
|
|
end
|
|
|
|
draw :sherlock
|
|
draw :development
|
|
draw :ci
|
|
|
|
use_doorkeeper do
|
|
controllers applications: 'oauth/applications',
|
|
authorized_applications: 'oauth/authorized_applications',
|
|
authorizations: 'oauth/authorizations'
|
|
end
|
|
|
|
use_doorkeeper_openid_connect
|
|
|
|
# Autocomplete
|
|
get '/autocomplete/users' => 'autocomplete#users'
|
|
get '/autocomplete/users/:id' => 'autocomplete#user'
|
|
get '/autocomplete/projects' => 'autocomplete#projects'
|
|
get '/autocomplete/award_emojis' => 'autocomplete#award_emojis'
|
|
|
|
# Search
|
|
get 'search' => 'search#show'
|
|
get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete
|
|
|
|
# JSON Web Token
|
|
get 'jwt/auth' => 'jwt#auth'
|
|
|
|
# Health check
|
|
get 'health_check(/:checks)' => 'health_check#index', as: :health_check
|
|
|
|
scope path: '-' do
|
|
get 'liveness' => 'health#liveness'
|
|
get 'readiness' => 'health#readiness'
|
|
post 'storage_check' => 'health#storage_check'
|
|
resources :metrics, only: [:index]
|
|
mount Peek::Railtie => '/peek'
|
|
|
|
# Boards resources shared between group and projects
|
|
resources :boards, only: [] do
|
|
resources :lists, module: :boards, only: [:index, :create, :update, :destroy] do
|
|
collection do
|
|
post :generate
|
|
end
|
|
|
|
resources :issues, only: [:index, :create, :update]
|
|
end
|
|
|
|
resources :issues, module: :boards, only: [:index, :update]
|
|
end
|
|
end
|
|
|
|
# Koding route
|
|
get 'koding' => 'koding#index'
|
|
|
|
draw :api
|
|
draw :sidekiq
|
|
draw :help
|
|
draw :snippets
|
|
|
|
# Invites
|
|
resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
|
|
member do
|
|
post :accept
|
|
match :decline, via: [:get, :post]
|
|
end
|
|
end
|
|
|
|
resources :sent_notifications, only: [], constraints: { id: /\h{32}/ } do
|
|
member do
|
|
get :unsubscribe
|
|
end
|
|
end
|
|
|
|
# Spam reports
|
|
resources :abuse_reports, only: [:new, :create]
|
|
|
|
# Notification settings
|
|
resources :notification_settings, only: [:create, :update]
|
|
|
|
draw :google_api
|
|
draw :import
|
|
draw :uploads
|
|
draw :explore
|
|
draw :admin
|
|
draw :profile
|
|
draw :dashboard
|
|
draw :group
|
|
draw :user
|
|
draw :project
|
|
|
|
root to: "root#index"
|
|
|
|
get '*unmatched_route', to: 'application#route_not_found'
|
|
end
|