Skip to content

request-time 20 with ad-hoc-view #87

Description

@mictadlo

I tried to run the below code in LightTable, but I got "request-time 20". What did I do wrong?

(ns couchdb-from-clojure.core
  (:require [com.ashafa.clutch :as clutch]))

(clutch/create-database "movies-db")

(clutch/with-db "movies-db"
  (clutch/bulk-update
  [{:movie-title "The Godfather"
    :director "Francis Ford Coppola"
    :runtime 175
    :year-released 1972
    :studio "Paramount"}
    {:movie-title "The Godfather II"
    :director "Francis Ford Coppola"
    :runtime 200
    :year-released 1974
    :studio "Paramount"}
    {:movie-title "The Godfather III"
    :director "Francis Ford Coppola"
    :runtime 162
    :year-released 1990
    :studio "Paramount"}
    {:movie-title "Psycho"
    :director "Gus Van Sant"
    :runtime 105
    :year-released 1998
    :studio "Universal Pictures"}]))


;; Temporary view example
(clutch/with-db "movies-db"
  (clutch/ad-hoc-view
  (clutch/view-server-fns :clojure
                          {:map (fn [doc] (when (and (:movie-title doc)
                                                      (:runtime doc))
                                            [[(:movie-title doc)
                                              (:runtime doc)]]))})))

This is the exception which I got:

clojure.lang.ExceptionInfo: throw+: {:trace-redirects ["http://localhost:5984/movies-db/_temp_view"], :request-time 20, :request {:path "/movies-db/_temp_view", :user-info nil, :follow-redirects true, :body-type org.apache.http.entity.StringEntity, :protocol "http", :password nil, :conn-timeout 5000, :as :stream, :username nil, :http-req #<HttpPost POST http://localhost:5984/movies-db/_temp_view HTTP/1.1>, :socket-timeout 0, :data-length nil, :port 5984, :save-request? true, :headers {"accept-encoding" "gzip, deflate", "content-type" "application/json", "user-agent" "com.ashafa.clutch/0.3.0", "accept" "*/*"}, :server-port 5984, :host "localhost", :http-url "http://localhost:5984/movies-db/_temp_view", :character-encoding "UTF-8", :uri "/movies-db/_temp_view", :anchor nil, :server-name "localhost", :query {}, :query-string nil, :body #<StringEntity org.apache.http.entity.StringEntity@5dffe431>, :scheme :http, :request-method :post, :data "{\"language\":\"clojure\",\"map\":\"(fn [doc] (when (and (:movie-title doc) (:runtime doc)) [[(:movie-title doc) (:runtime doc)]]))\"}"}, :status 500, :headers {"server" "CouchDB/1.6.1 (Erlang OTP/17)", "date" "Tue, 23 Dec 2014 05:02:56 GMT", "content-type" "text/plain; charset=utf-8", "content-length" "521", "cache-control" "must-revalidate"}, :body #<FilterInputStream$ff19274a clj_http.core.proxy$java.io.FilterInputStream$ff19274a@420856a2>}{:object {:trace-redirects ["http://localhost:5984/movies-db/_temp_view"], :request-time 20, :request {:path "/movies-db/_temp_view", :user-info nil, :follow-redirects true, :body-type org.apache.http.entity.StringEntity, :protocol "http", :password nil, :conn-timeout 5000, :as :stream, :username nil, :http-req #<HttpPost POST http://localhost:5984/movies-db/_temp_view HTTP/1.1>, :socket-timeout 0, :data-length nil, :port 5984, :save-request? true, :headers {"accept-encoding" "gzip, deflate", "content-type" "application/json", "user-agent" "com.ashafa.clutch/0.3.0", "accept" "*/*"}, :server-port 5984, :host "localhost", :http-url "http://localhost:5984/movies-db/_temp_view", :character-encoding "UTF-8", :uri "/movies-db/_temp_view", :anchor nil, :server-name "localhost", :query {}, :query-string nil, :body #<StringEntity org.apache.http.entity.StringEntity@5dffe431>, :scheme :http, :request-method :post, :data "{\"language\":\"clojure\",\"map\":\"(fn [doc] (when (and (:movie-title doc) (:runtime doc)) [[(:movie-title doc) (:runtime doc)]]))\"}"}, :status 500, :headers {"server" "CouchDB/1.6.1 (Erlang OTP/17)", "date" "Tue, 23 Dec 2014 05:02:56 GMT", "content-type" "text/plain; charset=utf-8", "content-length" "521", "cache-control" "must-revalidate"}, :body #<FilterInputStream$ff19274a clj_http.core.proxy$java.io.FilterInputStream$ff19274a@420856a2>}, :environment {request #cemerick.url.URL{:protocol "http", :username nil, :password nil, :host "localhost", :port 5984, :path "/movies-db/_temp_view", :query {}, :anchor nil, :headers {"Content-Type" "application/json", "User-Agent" "com.ashafa.clutch/0.3.0", "Accept" "*/*"}, :data-length nil, :data "{\"language\":\"clojure\",\"map\":\"(fn [doc] (when (and (:movie-title doc) (:runtime doc)) [[(:movie-title doc) (:runtime doc)]]))\"}", :method :post, :as :stream}, configuration {:path "/movies-db/_temp_view", :follow-redirects true, :protocol "http", :password nil, :conn-timeout 5000, :method :post, :as :stream, :username nil, :socket-timeout 0, :data-length nil, :port 5984, :save-request? true, :headers {"Content-Type" "application/json", "User-Agent" "com.ashafa.clutch/0.3.0", "Accept" "*/*"}, :host "localhost", :anchor nil, :query {}, :data "{\"language\":\"clojure\",\"map\":\"(fn [doc] (when (and (:movie-title doc) (:runtime doc)) [[(:movie-title doc) (:runtime doc)]]))\"}"}, data "{\"language\":\"clojure\",\"map\":\"(fn [doc] (when (and (:movie-title doc) (:runtime doc)) [[(:movie-title doc) (:runtime doc)]]))\"}", ex {:trace-redirects ["http://localhost:5984/movies-db/_temp_view"], :request-time 20, :request {:path "/movies-db/_temp_view", :user-info nil, :follow-redirects true, :body-type org.apache.http.entity.StringEntity, :protocol "http", :password nil, :conn-timeout 5000, :as :stream, :username nil, :http-req #<HttpPost POST http://localhost:5984/movies-db/_temp_view HTTP/1.1>, :socket-timeout 0, :data-length nil, :port 5984, :save-request? true, :headers {"accept-encoding" "gzip, deflate", "content-type" "application/json", "user-agent" "com.ashafa.clutch/0.3.0", "accept" "*/*"}, :server-port 5984, :host "localhost", :http-url "http://localhost:5984/movies-db/_temp_view", :character-encoding "UTF-8", :uri "/movies-db/_temp_view", :anchor nil, :server-name "localhost", :query {}, :query-string nil, :body #<StringEntity org.apache.http.entity.StringEntity@5dffe431>, :scheme :http, :request-method :post, :data "{\"language\":\"clojure\",\"map\":\"(fn [doc] (when (and (:movie-title doc) (:runtime doc)) [[(:movie-title doc) (:runtime doc)]]))\"}"}, :status 500, :headers {"server" "CouchDB/1.6.1 (Erlang OTP/17)", "date" "Tue, 23 Dec 2014 05:02:56 GMT", "content-type" "text/plain; charset=utf-8", "content-length" "521", "cache-control" "must-revalidate"}, :body #<FilterInputStream$ff19274a clj_http.core.proxy$java.io.FilterInputStream$ff19274a@420856a2>}}}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions