вывод терминала для приложения Rails выдает двойные запросы - PullRequest
5 голосов
/ 24 февраля 2020

Приложение My Rails генерирует двойные запросы при каждой загрузке страницы, и я не могу определить причину проблемы. Ответы здесь предлагают удалить все пустые / самоссылки href s и запустить rake assets:clean - но ни один из них не имеет никакого влияния.

Оба эти запроса идентичны, за исключением отметок времени и части обработки действия контроллера as. Первый запрос говорит Processing by TradesController#index as HTML, тогда как второй говорит Processing by TradesController#index as */*

Кто-нибудь еще имел дело с этим, и если так, как вы это исправили?

Started GET "/swaps" for 2600:1700:ba01:ff10:cc31:d814:a204:d70e at 2020-02-23 14:32:25 -0800
Processing by TradesController#index as HTML
User Load (0.5ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
(0.4ms)  SELECT COUNT(*) FROM "trades" WHERE "trades"."trade_requester_id" = $1 AND "trades"."approved_at" IS NULL  [["trade_requester_id", 1]]
(0.3ms)  SELECT COUNT(*) FROM "trades" WHERE "trades"."trade_recipient_id" = $1 AND "trades"."approved_at" IS NULL  [["trade_recipient_id", 1]]
Rendering trades/index.html.erb within layouts/application
Rendered trades/_trades_menu.html.erb (0.5ms)
CACHE  (0.0ms)  SELECT COUNT(*) FROM "trades" WHERE "trades"."trade_recipient_id" = $1 AND "trades"."approved_at" IS NULL  [["trade_recipient_id", 1]]
Rendered trades/index.html.erb within layouts/application (3.0ms)
CACHE  (0.0ms)  SELECT COUNT(*) FROM "trades" WHERE "trades"."trade_recipient_id" = $1 AND "trades"."approved_at" IS NULL  [["trade_recipient_id", 1]]
Transaction Load (0.5ms)  SELECT "transactions".* FROM "transactions" WHERE "transactions"."recipient_id" = $1 AND "transactions"."archived_by_recipient" = $2  [["recipient_id", 1], ["archived_by_recipient", false]]
Transaction Load (0.5ms)  SELECT "transactions".* FROM "transactions" WHERE "transactions"."sender_id" = $1 AND (state = 'approved' OR state = 'force_flipped' OR state = 'payment_sent' OR state = 'payment_declined' OR state = 'passed'  OR state = 'paid'  OR state = 'refunded'  OR state = 'shipped' OR state = 'received' OR state = 'not_received' OR state = 'unpaid' OR state = 'ignored' OR state = 'declined') AND "transactions"."archived_by_sender" = $2  [["sender_id", 1], ["archived_by_sender", false]]
PaymentTransfer Load (0.3ms)  SELECT "payment_transfers".* FROM "payment_transfers" WHERE "payment_transfers"."user_id" = $1 AND (user_id = 1 AND read = FALSE)  [["user_id", 1]]
CACHE Transaction Load (0.0ms)  SELECT "transactions".* FROM "transactions" WHERE "transactions"."recipient_id" = $1 AND "transactions"."archived_by_recipient" = $2  [["recipient_id", 1], ["archived_by_recipient", false]]
CACHE Transaction Load (0.0ms)  SELECT "transactions".* FROM "transactions" WHERE "transactions"."sender_id" = $1 AND (state = 'approved' OR state = 'force_flipped' OR state = 'payment_sent' OR state = 'payment_declined' OR state = 'passed'  OR state = 'paid'  OR state = 'refunded'  OR state = 'shipped' OR state = 'received' OR state = 'not_received' OR state = 'unpaid' OR state = 'ignored' OR state = 'declined') AND "transactions"."archived_by_sender" = $2  [["sender_id", 1], ["archived_by_sender", false]]
CACHE PaymentTransfer Load (0.0ms)  SELECT "payment_transfers".* FROM "payment_transfers" WHERE "payment_transfers"."user_id" = $1 AND (user_id = 1 AND read = FALSE)  [["user_id", 1]]
(1.2ms)  SELECT COUNT(*) FROM "conversations" INNER JOIN "messages" ON "messages"."conversation_id" = "conversations"."id" INNER JOIN "users" ON "users"."id" = "messages"."user_id" WHERE ((conversations.sender_id = 1 OR conversations.receiver_id = 1)) AND (messages.user_id != 1 AND read = FALSE)
Rendered layouts/_header.html.erb (9.2ms)
Completed 200 OK in 58ms (Views: 48.5ms | ActiveRecord: 4.2ms)
(0.2ms)  BEGIN
(0.2ms)  COMMIT

Started GET "/swaps" for 2600:1700:ba01:ff10:cc31:d814:a204:d70e at 2020-02-23 14:32:26 -0800
Processing by TradesController#index as */*
User Load (0.5ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
(0.4ms)  SELECT COUNT(*) FROM "trades" WHERE "trades"."trade_requester_id" = $1 AND "trades"."approved_at" IS NULL  [["trade_requester_id", 1]]
(0.4ms)  SELECT COUNT(*) FROM "trades" WHERE "trades"."trade_recipient_id" = $1 AND "trades"."approved_at" IS NULL  [["trade_recipient_id", 1]]
Rendering trades/index.html.erb within layouts/application
Rendered trades/_trades_menu.html.erb (0.6ms)
CACHE  (0.0ms)  SELECT COUNT(*) FROM "trades" WHERE "trades"."trade_recipient_id" = $1 AND "trades"."approved_at" IS NULL  [["trade_recipient_id", 1]]
Rendered trades/index.html.erb within layouts/application (27.1ms)
CACHE  (0.0ms)  SELECT COUNT(*) FROM "trades" WHERE "trades"."trade_recipient_id" = $1 AND "trades"."approved_at" IS NULL  [["trade_recipient_id", 1]]
Transaction Load (0.5ms)  SELECT "transactions".* FROM "transactions" WHERE "transactions"."recipient_id" = $1 AND "transactions"."archived_by_recipient" = $2  [["recipient_id", 1], ["archived_by_recipient", false]]
Transaction Load (0.6ms)  SELECT "transactions".* FROM "transactions" WHERE "transactions"."sender_id" = $1 AND (state = 'approved' OR state = 'force_flipped' OR state = 'payment_sent' OR state = 'payment_declined' OR state = 'passed'  OR state = 'paid'  OR state = 'refunded'  OR state = 'shipped' OR state = 'received' OR state = 'not_received' OR state = 'unpaid' OR state = 'ignored' OR state = 'declined') AND "transactions"."archived_by_sender" = $2  [["sender_id", 1], ["archived_by_sender", false]]
PaymentTransfer Load (0.3ms)  SELECT "payment_transfers".* FROM "payment_transfers" WHERE "payment_transfers"."user_id" = $1 AND (user_id = 1 AND read = FALSE)  [["user_id", 1]]
CACHE Transaction Load (0.0ms)  SELECT "transactions".* FROM "transactions" WHERE "transactions"."recipient_id" = $1 AND "transactions"."archived_by_recipient" = $2  [["recipient_id", 1], ["archived_by_recipient", false]]
CACHE Transaction Load (0.0ms)  SELECT "transactions".* FROM "transactions" WHERE "transactions"."sender_id" = $1 AND (state = 'approved' OR state = 'force_flipped' OR state = 'payment_sent' OR state = 'payment_declined' OR state = 'passed'  OR state = 'paid'  OR state = 'refunded'  OR state = 'shipped' OR state = 'received' OR state = 'not_received' OR state = 'unpaid' OR state = 'ignored' OR state = 'declined') AND "transactions"."archived_by_sender" = $2  [["sender_id", 1], ["archived_by_sender", false]]
CACHE PaymentTransfer Load (0.0ms)  SELECT "payment_transfers".* FROM "payment_transfers" WHERE "payment_transfers"."user_id" = $1 AND (user_id = 1 AND read = FALSE)  [["user_id", 1]]
(0.7ms)  SELECT COUNT(*) FROM "conversations" INNER JOIN "messages" ON "messages"."conversation_id" = "conversations"."id" INNER JOIN "users" ON "users"."id" = "messages"."user_id" WHERE ((conversations.sender_id = 1 OR conversations.receiver_id = 1)) AND (messages.user_id != 1 AND read = FALSE)
Rendered layouts/_header.html.erb (8.7ms)
Completed 200 OK in 152ms (Views: 116.6ms | ActiveRecord: 4.1ms)
(0.1ms)  BEGIN
(0.1ms)  COMMIT
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...