Method: RubyApp::Session.start_thread!

Defined in:
lib/ruby_app/session.rb

.start_thread!Object



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/ruby_app/session.rb', line 176

def self.start_thread!
  unless @@_thread ||= nil
    @@_thread = Thread.new do
      begin
        while true
          RubyApp::Session.sessions.values.each do |session|
            if session.expired?
              RubyApp::Log.debug("SESSION   session.session_id=#{session.session_id.inspect}")
              RubyApp::Log.debug("SESSION   session.quit!")
              session.quit!
            end
          end
          sleep(RubyApp::Session.configuration.interval)
        end
      rescue => exception
        RubyApp::Log.exception(RubyApp::Log::ERROR, exception)
      end
    end

    RubyApp::Log.debug("SESSION   #{RubyApp::Log.prefix(self, __method__)}")

  end
end