Fix user id cache expiration.

Use a delayed job instead of a HTTP request to invalidate the user id
cache on both servers.
This commit is contained in:
evazion
2018-01-28 20:47:29 -06:00
parent e16ae00efc
commit 909c9aad5a
3 changed files with 1 additions and 11 deletions

View File

@@ -71,12 +71,6 @@ class UsersController < ApplicationController
respond_with(@user, location: edit_user_path(@user))
end
def cache
@user = User.find(params[:id])
@user.update_cache
render plain: ""
end
private
def check_privilege(user)

View File

@@ -191,7 +191,7 @@ class User < ApplicationRecord
def update_remote_cache
if saved_change_to_name?
Danbooru.config.other_server_hosts.each do |server|
HTTParty.delete("http://#{server}/users/#{id}/cache", Danbooru.config.httparty_options)
delay(queue: server).update_cache
end
end
rescue Exception

View File

@@ -291,10 +291,6 @@ Rails.application.routes.draw do
get :search
get :custom_style
end
member do
delete :cache
end
end
resource :user_upgrade, :only => [:new, :create, :show]
resources :user_feedbacks do