             ^ManyToManyChannel    stat-chan             (chan)
             ^ManyToManyChannel    work-chan             (chan)
             ^PersistentHashMap    client-config         (get-in config [:ok :couchbase-client])
-            ^CouchbaseCljClient   client                (connect client-config)
+            ^CouchbaseCljClient   client-conn           (connect client-config)
             ^PersistentArrayMap   view-config           (get-in config [:ok :couchbase-view])
             ^String               design-document-name  (:design-document-name view-config)
             ^String               view-name             (:view-name view-config)

                ;else - timeout 
                (do 
                  (log/info "Channel timed out. Stopping...") 
                  (client/shutdown client)
                  (exit 0)))))))

    ;; end main

  ;return
  client-connection)

(defn get-batch 
  [client-conn design-document-name view-name query-options batch-size]
  (client/lazy-query client-conn design-document-name view-name query-options batch-size))

(defn get-ids
  [batch]
  (try 
    {:ok (doall (map client/view-id batch)) } 
  (catch Exception e 
    {:error "Exception" :fn "get-ids" :exception (.getMessage e) })))

(defn exit [n] 
  (log/info "init :: stop")
  (System/exit n))
