Skip to content

通信が1時間なかったらonlineから外すようにした #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

mori-atsushi
Copy link
Collaborator

action cableでunsubscribeが呼ばれない場合がある

  • サーバの再起動やdeployが行われたタイミング
  • 長期間通信がなかった場合

通信時にroom_user_logのupdated_atを更新し、それによってonlnieに表示するかしないか切り替えるようにした

懸念点

  • テストではupdated_atのchangeを確認できないので、かけてない

@codecov
Copy link

codecov bot commented Apr 13, 2019

Codecov Report

Merging #107 into development will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #107      +/-   ##
===============================================
+ Coverage        97.59%   97.63%   +0.03%     
===============================================
  Files               33       33              
  Lines              415      422       +7     
===============================================
+ Hits               405      412       +7     
  Misses              10       10
Impacted Files Coverage Δ
app/models/user_room_log.rb 100% <100%> (ø) ⬆️
app/channels/room_channel.rb 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8eb25d8...e2aa83c. Read the comment docs.

@mori-atsushi mori-atsushi force-pushed the 96-fix-unsubscribe branch from 708f5a6 to 2641f75 Compare May 1, 2019 23:34
@@ -7,7 +7,7 @@ class UserRoomLog < ApplicationRecord
after_create :send_enter_message
after_update :send_exit_message, if: proc { |log| log.exit_at_before_last_save.blank? && log.exit_at.present? }

scope :online, -> { where exit_at: nil }
scope :online, -> { where(exit_at: nil).where("updated_at > ?", Time.now.utc - 60 * 60) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
scope :online, -> { where(exit_at: nil).where("updated_at > ?", Time.now.utc - 60 * 60) }
scope :online, -> { where(exit_at: nil).where(updated_at: 1.hour.ago..Time.current) }

end
end

context "when exit_at exsit" do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
context "when exit_at exsit" do
context "when exit_at exist" do

Copy link
Collaborator

@euglena1215 euglena1215 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

みました

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants