core/rails/app/controllers/support_controller.rb
# supplies UI heartbeat information
# /api/status/heartbeat
supplies UI heartbeat information
api/status/heartbeat
supplies UI heartbeat information api / status / heartbeat
def heartbeat
    if session[:marker] != params[:marker]
      session[:marker] = params[:marker]
      session[:start] = Time.now
    end
    elapsed = (Time.now - session[:start]) rescue 0
    nodes = Node.count
    total = nil
    error = nil
    active = nil
    NodeRole.transaction do   
      total = NodeRole.count
      error = NodeRole.where(state: NodeRole::ERROR).count
      active = NodeRole.where(state: NodeRole::ACTIVE).count
    end
    render :json=>{ :active=>active, :todo=>(total-error-active), :error=>error, :elapsed=>elapsed.to_i, :nodes=>nodes } 
  end
def heartbeat if session [ :marker ] != params [ :marker ] session [ :marker ] = params [ :marker ] session [ :start ] = Time . now end elapsed = ( Time . now - session [ :start ] ) rescue 0 nodes = Node . count total = nil error = nil active = nil NodeRole . transaction do total = NodeRole . count error = NodeRole . where ( state : NodeRole :: ERROR ) . count active = NodeRole . where ( state : NodeRole :: ACTIVE ) . count end render :json => { :active => active , :todo => ( total - error - active ) , :error => error , :elapsed => elapsed . to_i , :nodes => nodes } end
supplies UI heartbeat information
api/status/heartbeat
supplies UI heartbeat information api / status / heartbeat
# performance optimization