Increase pet loading timeout

This commit is contained in:
Emi Matchu 2024-01-23 22:10:42 -08:00
parent 76af587e7c
commit 44d9f98313
2 changed files with 4 additions and 2 deletions

View file

@ -8,7 +8,6 @@ class PetsController < ApplicationController
@pet = Pet.load( @pet = Pet.load(
params[:name], params[:name],
:item_scope => Item.includes(:translations), :item_scope => Item.includes(:translations),
:timeout => 1
) )
points = contribute(current_user, @pet) points = contribute(current_user, @pet)

View file

@ -44,7 +44,10 @@ class Pet < ApplicationRecord
options[:item_scope]) options[:item_scope])
end end
def fetch_viewer_data(timeout=4, locale=nil) # NOTE: Ideally pet requests shouldn't take this long, but Neopets can be
# slow sometimes! Since we're on the Falcon server, long timeouts shouldn't
# slow down the rest of the request queue, like it used to be in the past.
def fetch_viewer_data(timeout=10, locale=nil)
locale ||= I18n.default_locale locale ||= I18n.default_locale
begin begin
neopets_language_code = I18n.compatible_neopets_language_code_for(locale) neopets_language_code = I18n.compatible_neopets_language_code_for(locale)